mirror of
https://github.com/qwertyforce/scenery.git
synced 2025-05-25 16:59:47 +00:00
29 lines
708 B
TypeScript
29 lines
708 B
TypeScript
import express from 'express'
|
|
import next from 'next'
|
|
|
|
const port = parseInt((process.env.PORT as string), 10) || 3000
|
|
const dev = process.env.NODE_ENV !== 'production'
|
|
const app = next({ dev })
|
|
const handle = app.getRequestHandler()
|
|
|
|
app.prepare().then(() => {
|
|
const server = express()
|
|
server.disable('x-powered-by');
|
|
|
|
// server.get('/a', (req, res) => {
|
|
// return app.render(req, res, '/a', req.query)
|
|
// })
|
|
|
|
// server.get('/b', (req, res) => {
|
|
// return app.render(req, res, '/b', req.query)
|
|
// })
|
|
|
|
server.all('*', (req, res) => {
|
|
return handle(req, res)
|
|
})
|
|
|
|
server.listen(port, (err) => {
|
|
if (err) throw err
|
|
console.log(`> Ready on http://localhost:${port}`)
|
|
})
|
|
}) |