summaryrefslogtreecommitdiffstats
path: root/frontend/server.js
blob: 618dfc07e28cad17318c3f54c1248c81f86e38ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// server.js
const next = require('next');
const routes = require('./routes');

const app = next({ dev: process.env.NODE_ENV !== 'production' });
const handler = routes.getRequestHandler(app);

// With express
const express = require('express');

app.prepare().then(() => {
  express()
    .use(handler)
    .listen(3000);
});

// Without express
const { createServer } = require('http');

app.prepare().then(() => {
  createServer(handler).listen(6969);
});