Skip to content

Commit 2e37ef8

Browse files
committed
Add port via process env
- This allows deployment to heroku
1 parent 0a0ae95 commit 2e37ef8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { createServer } = require('http');
22
const { parse } = require('url');
33
const next = require('next');
44

5+
const port = process.env.PORT || 3000
56
const dev = process.env.NODE_ENV !== 'production';
67
const app = next({ dev });
78

@@ -14,9 +15,9 @@ app.prepare().then(() => {
1415
query.pathName = pathname;
1516

1617
app.render(req, res, '/index', query);
17-
}).listen(80, (err) => {
18+
}).listen(port, (err) => {
1819
if (err) throw err;
1920
// eslint-disable-next-line no-console
20-
console.log('> Ready on http://localhost:80');
21+
console.log(`> Ready on http://localhost:${port}`);
2122
});
2223
});

0 commit comments

Comments
 (0)