-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
29 lines (23 loc) · 811 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const express = require('express');
const path = require('path');
const logger = require('morgan');
const bodyParser = require('body-parser');
const favicon = require('serve-favicon');
const port = process.env.PORT || 82;
const app = express();
app.use('/', express.static(path.join(__dirname, 'build')));
app.set('views', path.join(__dirname, 'public/views'));
app.set('view engine', 'jade');
app.use(favicon(`${__dirname}/public/favicon.png`));
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// catch 404 and forward to error handler
app.use((req, res, next) => {
const err = new Error('Not Found');
err.status = 404;
next(err);
});
app.listen(port, () => {
console.log('listening on port ', port); // eslint-disable-line no-console
});