forked from stefina/pokemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (19 loc) · 649 Bytes
/
app.js
File metadata and controls
24 lines (19 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var express = require('express'),
mongoose = require('mongoose'),
fs = require('fs'),
config = require('./config/config');
mongoose.connect(config.db_uri, {auth : config.auth});
var db = mongoose.connection;
db.on('error', function () {
throw new Error('unable to connect to database at ' + config.db);
});
var modelsPath = __dirname + '/app/models';
fs.readdirSync(modelsPath).forEach(function (file) {
if (file.indexOf('.js') >= 0) {
require(modelsPath + '/' + file);
}
});
var app = express();
var passport = require('./config/express')(app, config, express);
require('./config/routes')(app, passport);
app.listen(config.port);