this repo has no description
1const express = require('express')
2const next = require('next')
3const { createProxyMiddleware } = require('http-proxy-middleware')
4
5const port = 7000
6const app = next({ dev: true })
7const handle = app.getRequestHandler()
8
9app.prepare().then(() => {
10 const server = express()
11
12 server.use('/api', createProxyMiddleware({ target: 'http://localhost:7000', ws: true }))
13
14 server.all('*', (req, res) => {
15 return handle(req, res)
16 })
17
18 server.listen(port, (err) => {
19 if (err) throw err
20 console.log(`> Ready on http://localhost:${port}`)
21 })
22})