-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
32 lines (28 loc) · 932 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
31
32
// This file was added by edgio init.
// You should commit this file to source control.
import { Router, edgioRoutes } from '@edgio/core'
import transform from './transform'
export default new Router()
// Here is an example where we cache api/* at the edge but prevent caching in the browser
// .match('/api/:path*', {
// caching: {
// max_age: '1d',
// stale_while_revalidate: '1h',
// // bypass_client_cache: true,
// service_worker_max_age: '1d',
// },
// })
.match('/', ({ proxy }) => {
proxy('origin', {
// transformResponse: res => {
// console.log('-------------------------');
// console.log('res');
// console.log(res.rawHeaders);
// console.log('-------------------------');
// res.body = 'some string'
// }
transformResponse: transform
})
})
// plugin enabling basic Edgio functionality
.use(edgioRoutes)