rsnext/test/integration/custom-routes/next.config.js

99 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-11-09 23:34:53 +01:00
module.exports = {
// target: 'serverless',
2019-11-09 23:34:53 +01:00
experimental: {
async rewrites() {
2019-11-09 23:34:53 +01:00
return [
{
source: '/hello-world',
destination: '/static/hello.txt',
},
2019-11-09 23:34:53 +01:00
{
source: '/',
destination: '/another',
2019-11-09 23:34:53 +01:00
},
{
source: '/another',
destination: '/multi-rewrites',
2019-11-09 23:34:53 +01:00
},
{
source: '/first',
destination: '/hello',
2019-11-09 23:34:53 +01:00
},
{
source: '/second',
destination: '/hello-again',
2019-11-09 23:34:53 +01:00
},
{
source: '/test/:path',
destination: '/:path',
2019-11-09 23:34:53 +01:00
},
{
source: '/test-overwrite/:something/:another',
destination: '/params/this-should-be-the-value',
2019-11-09 23:34:53 +01:00
},
{
source: '/params/:something',
destination: '/with-params',
},
2019-11-09 23:34:53 +01:00
]
},
async redirects() {
2019-11-09 23:34:53 +01:00
return [
{
source: '/docs/router-status/:code',
destination: '/docs/v2/network/status-codes#:code',
statusCode: 301,
},
{
source: '/docs/github',
destination: '/docs/v2/advanced/now-for-github',
statusCode: 301,
},
{
source: '/docs/v2/advanced/:all(.*)',
destination: '/docs/v2/more/:all',
statusCode: 301,
},
2019-11-09 23:34:53 +01:00
{
source: '/hello/:id/another',
destination: '/blog/:id',
2019-11-09 23:34:53 +01:00
},
{
source: '/redirect1',
destination: '/',
2019-11-09 23:34:53 +01:00
},
{
source: '/redirect2',
destination: '/',
statusCode: 301,
2019-11-09 23:34:53 +01:00
},
{
source: '/redirect3',
destination: '/another',
statusCode: 302,
2019-11-09 23:34:53 +01:00
},
{
source: '/redirect4',
destination: '/',
statusCode: 308,
2019-11-09 23:34:53 +01:00
},
{
source: '/redir-chain1',
destination: '/redir-chain2',
statusCode: 301,
2019-11-09 23:34:53 +01:00
},
{
source: '/redir-chain2',
destination: '/redir-chain3',
statusCode: 302,
2019-11-09 23:34:53 +01:00
},
{
source: '/redir-chain3',
destination: '/',
statusCode: 303,
},
2019-11-09 23:34:53 +01:00
]
},
},
2019-11-09 23:34:53 +01:00
}