-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (31 loc) · 992 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
36
require('dotenv').load();
var express = require('express');
var config = require('./config/config');
var glob = require('glob');
var mongoose = require('mongoose');
var methodOverride = require('method-override');
var bodyParser = require('body-parser');
// var ig = require('instagram-node').instagram();
// MongoDB Setup
mongoose.connect(config.db);
var db = mongoose.connection;
db.on('error', function () {
throw new Error('unable to connect to database at ' + config.db);
});
// Require all the models in our app
var models = glob.sync(config.root + '/app/models/*.js');
models.forEach(function (model) {
require(model);
});
// App Initialization
var app = express();
require('./config/express')(app, config);
// //Instagram
// ig.use({
// client_id: process.env.INSTAGRAM_API_KEY,
// client_secret: process.env.INSTAGRAM_API_SECRET
// });
// Server Start :)
app.listen(config.port, function () {
console.log('Express server listening on port ' + config.port);
});