Skip to content

Commit

Permalink
Remove path specific switch statement from http2 example (vercel#16558)
Browse files Browse the repository at this point in the history
Is this switch necessary
  • Loading branch information
mohsen1 authored Sep 6, 2020
1 parent b5cf3e4 commit e2cdf21
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions examples/with-http2/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit e2cdf21

Please sign in to comment.