450742274a
This corrects the case where `/index` is used during revalidation for an optional catch-all route and `index` is passed as a param even though it should be undefined. This also adds test cases to make sure the params are normalized correctly Fixes: https://github.com/vercel/next.js/issues/16366
27 lines
664 B
JavaScript
27 lines
664 B
JavaScript
const path = require('path')
|
|
const http = require('http')
|
|
|
|
const server = http.createServer(async (req, res) => {
|
|
const render = async (page) => {
|
|
const mod = require(`./${path.join('.next/serverless/pages/', page)}`)
|
|
try {
|
|
return await (mod.render || mod.default || mod)(req, res)
|
|
} catch (err) {
|
|
res.statusCode = 500
|
|
return res.end('internal error')
|
|
}
|
|
}
|
|
|
|
try {
|
|
await render('/[[...slug]].js')
|
|
} catch (err) {
|
|
console.error('failed to render', err)
|
|
res.statusCode = 500
|
|
res.end('Internal Error')
|
|
}
|
|
})
|
|
|
|
const port = process.env.PORT || 3000
|
|
server.listen(port, () => {
|
|
console.log('ready on', port)
|
|
})
|