Spaces:
Paused
Paused
| const express = require('express'); | |
| const next = require('next'); | |
| const dev = process.env.NODE_ENV !== 'production'; | |
| const app = next({ dev }); | |
| const handle = app.getRequestHandler(); | |
| const port = process.env.PORT || 3001; | |
| app.prepare().then(() => { | |
| const server = express(); | |
| // Handle ALL routes and methods (GET, POST, etc.) | |
| server.all('*', (req, res) => { | |
| return handle(req, res); | |
| }); | |
| server.listen(port, (err) => { | |
| if (err) throw err; | |
| console.log(`> Open-View Ready on http://localhost:${port}`); | |
| console.log(`> Access via: http://localhost:${port}`); | |
| }); | |
| }); | |