-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (28 loc) · 877 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
34
35
36
37
'use strict';
var express = require('express');
var consign = require('consign');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var config = require('config');
var app = null;
var server = null;
var mongourl = config.get('mongourl');
global.db = mongoose.createConnection(mongourl);
global.db.once('open', function () {
});
var app = express();
var port = config.get('port');
// Json parser for post data
app.use(bodyParser.json());
consign({cwd: process.cwd() + '/app'})
.include('models')
.include('controllers')
.include('routes')
.into(app);
var server = app.listen(port, function () {
console.log('Nogueira Storage listening at http://%s:%s',
server.address().address, server.address().port);
require('carbono-service-manager');
});
module.exports.app = app;
module.exports.server = server;