-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
35 lines (27 loc) · 961 Bytes
/
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
global.express = require('express');
global._ = require('underscore');
global.async = require('async');
global.http = require('http');
global.mongoose = require('mongoose');
global.ObjectId = mongoose.mongo.ObjectID;
global.db = require('./config/db-schema.js').mongodb();
// local env
// mongoose.connect('mongodb://localhost/squirrel');
// staging env
// mongoose.connect(process.env.MONGO_STAGINGDB);
mongoose.connect('mongodb://nodejitsu_deeznutz:[email protected]:39267/nodejitsu_deeznutz_nodejitsudb2606280623');
// production env
// mongoose.connect(process.env.MONGO_PRODUCTIONDB);
global.server = express();
require('./config/middleware.js')(server);
require('./config/routes.js')(server);
server.listen(8080, function() {
console.log('%s listening at 8080', server.name);
});
if(typeof module.exports !== 'undefined') {
module.exports = {
server: server,
User: db.User,
Message: db.Message
};
}