-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (31 loc) · 1.05 KB
/
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
36
37
var express = require('express')
var favicon = require('serve-favicon')
var morgan = require('morgan')
var errorhandler = require('errorhandler')
var router = express.Router()
var routes = require('./routes/routes.js')
var http = require('http')
var path = require('path')
var cookieParser = require('cookie-parser')
require('dotenv').config()
var app = express()
// all environments
app.set('port', process.env.VCAP_APP_PORT || 3000)
app.set('views', __dirname + '/views')
app.set('view engine', 'pug')
app.use(favicon(path.join(__dirname, 'public', 'images', 'favicon.png')))
app.use(morgan('dev'))
app.use(cookieParser())
app.use(express.static(path.join(__dirname, 'public')))
// development only
if ('development' === app.get('env')) {
app.use(errorhandler())
}
router.get('/', routes.totals)
router.get('/mates', routes.mates)
router.get('/chance', routes.chance)
router.get('/completion', routes.completion)
app.use(router)
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'))
})