-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (24 loc) · 838 Bytes
/
index.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
30
31
32
const express = require('express');
const app = express();
// Set up environment variables.
const config = require('./config');
// Set up bodyParser.
const bodyParser = require('body-parser');
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// Set up templating.
app.set('view engine', 'pug');
app.locals.moment = require('moment');
// Set up static file serving.
app.use(express.static('public'));
app.use(express.static('bower_components'));
// Require routes.
require('./routes')(app);
// Set locals for pug.
app.locals.env = {};
app.locals.env[process.env.ENVIRONMENT] = true;
// Start the app.
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log('app started. listening on', port);
});