-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (27 loc) · 895 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
var jsonld = require('jsonld'),
MongoClient = require('mongodb').MongoClient,
ObjectID = require('mongodb').ObjectID,
assert = require('assert'),
express = require('express'),
config = require('./config/config'),
path = require('path');
// TODO: Move mongo out of here??
// MongoDB Connection
MongoClient.connect(config.mongo_url, function(err, db) {
assert.equal(null, err);
console.log("Connected correctly to Mongo server.");
});
var app = express();
app.set('view engine', 'jade');
app.use(express.static(path.join(__dirname, 'public')));
require('./config/routes')(app, config);
var server;
server = app.listen(config.port, function() {
console.log('Express server listening on port ' + server.address().port);
});
module.exports = {
app: app,
server: server,
config: config,
MongoClient: MongoClient
}