-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
35 lines (27 loc) · 949 Bytes
/
app.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
33
34
35
var path = require('path'),
bodyParser = require('body-parser'),
express = require('express'),
locations = require('./locations/locations');
require('dotenv').config();
var app = express();
app.locations = locations;
// allow custom bower install location with default
var bowerComponents = path.join(__dirname + '/bower_components');
if (process.env.BOWER_PATH) {
bowerComponents = path.join(process.env.BOWER_PATH + '/bower_components');
};
app.use(express.static('public'));
app.use('/bower_components', express.static(bowerComponents));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.set('view engine', 'pug');
app.set('views', path.resolve('public/views'));
// default to port 3000, but allow custom env PORT to override
var port = process.env.PORT || 3000;
app.listen(port, function() {
// load routes
require('./routes')(app);
console.log('App listening on port ' + port);
});