-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (34 loc) · 1.21 KB
/
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
/**
* Module dependencies.
*/
var express = require('express');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var bodyParser = require('body-parser')
var session = require('express-session');
var methodOverride = require('method-override');
var favicon = require('serve-favicon');
var http = require('http');
var path = require('path');
var app = express();
var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
var request = require('request');
// all environments
app.set('port', process.env.PORT || 4220);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(cookieParser());
app.use(session({ secret: 'beta-engine', resave:false, saveUninitialized:false}));
app.use(methodOverride());
var MongoDB = require('mongodb').Db;
var Server = require('mongodb').Server;
var mongojs = require('mongojs');
require('./api/routes/main.js')(app);
app.use(express.static(path.join(__dirname, 'public')));
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});