-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathroutes.js
30 lines (27 loc) · 1006 Bytes
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Router } from '@edgio/core'
import { vueRoutes } from '@edgio/vue-cva'
import getPrerenderRequests from './edgio/getPrerenderRequests'
import { API_CACHE_HANDLER, IMAGE_CACHE_HANDLER, EDGE_CACHE_HANDLER } from './edgio/cache'
import { isProductionBuild } from '@edgio/core/environment'
const router = new Router()
/**
* Pre-render the static home page
* More on static prerendering: https://docs.edg.io/guides/static_prerendering
*/
.prerender(getPrerenderRequests)
// API (Any backend) caching
.match('/edgio-api/:path*', API_CACHE_HANDLER)
// Image caching
.match('/edgio-opt', IMAGE_CACHE_HANDLER)
// default vue3 routes
.use(vueRoutes)
// Only compiled with edgio build / edgio deploy
if (isProductionBuild()) {
router
.match('/', EDGE_CACHE_HANDLER)
.match('/about', EDGE_CACHE_HANDLER)
.match('/commerce', EDGE_CACHE_HANDLER)
.match('/product/:path', EDGE_CACHE_HANDLER)
.match('/commerce/:path', EDGE_CACHE_HANDLER)
}
export default router