Try optional catch all routing (#1277)

* try optional catch all routing

* use rewrites

* move rewrite to vercel.json

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
main
Mike Fix 3 years ago committed by GitHub
parent 1bd289b9d4
commit 292dfc9057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,8 +43,12 @@ module.exports = async (req, res) => {
})
try {
const { state, id, ...params } =
req.method === 'GET' ? req.query : await json(req, { limit: '6mb' })
const {
state,
id: _id,
...params
} = req.method === 'GET' ? req.query : await json(req, { limit: '6mb' })
const id = _id && _id !== 'index' ? _id : undefined
const page = await browser.newPage()

@ -1 +0,0 @@
module.exports = require('./[id]')

@ -5,5 +5,6 @@
"github": {
"autoAlias": false,
"silent": true
}
},
"rewrites": [{ "source": "/api/image", "destination": "/api/image/index" }]
}
Loading…
Cancel
Save