-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
46 lines (35 loc) · 996 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var express = require('express')
var path = require('path')
var logger = require('morgan')
var router = require('./router/router')
var app = express()
app.set('port', (process.env.PORT || 3000))
app.engine('html', require('ejs').renderFile)
app.set('view engine', 'html')
app.use(express.static(path.join(__dirname, 'public')))
console.log(path.join(__dirname, 'public'))
app.use('/', router)
app.listen(app.get('port'), function() {
console.log('Elections server listening on port ' + app.get('port'))
})
app.use(logger('dev'))
/*if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.send({
message: err.message,
error: err
});
});
} else {
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.send('error', {
message: err.message,
error: {}
});
});
}*/
module.exports = app;