-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
39 lines (30 loc) · 907 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
var express = require("express")
var app = express()
var dotenv = require('dotenv');
dotenv.load();
var port = process.env.PORT || 3000
app.configure(function() {
app.use(express.static(__dirname + "/public"))
app.use(express.json())
app.use(express.urlencoded())
app.use(express.cookieParser(process.env.SESSION_SECRET));
app.use(express.session({secret: process.env.SESSION_SECRET}));
app.set("views", __dirname + "/views")
app.set("view engine", "jade")
})
app.configure("development", function() {
app.use(express.logger())
})
app.configure("production", function() {
app.use(express.logger())
})
require('./lib/routes')(app)
/*
* Start the server, unless we are in tests mode
* If NODE_ENV is test, the server will be controlled by the tests
*/
if (app.get("env") != "test") {
app.listen(port)
console.log('Server running on ' + port)
}
exports = module.exports = app