Remove path specific switch statement from http2 example (#16558)

Is this switch necessary
This commit is contained in:
Mohsen Azimi 2020-09-05 20:08:20 -04:00 committed by GitHub
parent b5cf3e4c94
commit e2cdf215bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,19 +17,9 @@ const server = http2.createSecureServer({
app.prepare().then(() => {
server.on('error', (err) => console.error(err))
// Process the various routes based on `req`
// `/` -> Render index.js
// `/about` -> Render about.js
server.on('request', (req, res) => {
switch (req.url) {
case '/about':
return app.render(req, res, '/about', req.query)
default:
return app.render(req, res, '/', req.query)
}
app.render(req, res, req.url || '/', req.query)
})
server.listen(port)
console.log(`Listening on HTTPS port ${port}`)