-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.js
51 lines (40 loc) · 1.57 KB
/
server.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
47
48
49
50
51
// ====================================================
// Global Variables
// ====================================================
var express = require('express'),
//livereload = require('express-livereload'),
app = express(),
expressValidator = require('express-validator'),
logger = require('express-logger');
// ====================================================
// APP CONFIG
// ====================================================
//var conf = require('./app/config/conf.example.js');
var bodyParser = require('body-parser');
app.set('view engine', 'jade');
app.set('views', __dirname + '/app/views');
app.use(express.static(__dirname + '/app/assets/'));
app.use(logger({path: "./logfile.txt"}));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(expressValidator());
// ====================================================
// MONGODB
// ====================================================
//var mongoose = require('mongoose');
// ====================================================
// ROUTING
// ====================================================
var router = require('./app/router')(app);
app.use(function(err, req, res, next) {
res.status(err.status || 500);
});
module.exports = app;
// ====================================================
// SERVER
// ====================================================
//livereload(app, {watchDir: process.cwd() + "/app/"});
var port = process.env.PORT || 5000;
app.listen(port, function(){
console.log('Listening on ' + port);
});