dd6a08980a
This updates collecting dynamic route params on Vercel to make sure that missing optional dynamic routes are undefined. Additional tests for this mode have also been added to ensure the params are being collected properly Closes: https://github.com/vercel/next.js/issues/15579
24 lines
535 B
JavaScript
24 lines
535 B
JavaScript
const path = require('path')
|
|
const http = require('http')
|
|
|
|
const server = http.createServer((req, res) => {
|
|
const pagePath = (page) => path.join('.next/serverless/pages/', page)
|
|
const render = (page) => {
|
|
require(`./${pagePath(page)}`).render(req, res)
|
|
}
|
|
|
|
switch (req.url) {
|
|
case '/docs/gssp': {
|
|
return render('/gssp.js')
|
|
}
|
|
default: {
|
|
res.statusCode = 404
|
|
return res.end('404')
|
|
}
|
|
}
|
|
})
|
|
|
|
const port = process.env.PORT || 3000
|
|
server.listen(port, () => {
|
|
console.log('ready on', port)
|
|
})
|