-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (27 loc) · 827 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
var express = require("express");
var app = express();
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var session = require('express-session');
var consign = require('consign');
var secret = require('./secret');
var options = {
useMongoClient: true
}
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
mongoose.Promise = global.Promise;
mongoose.connect(secret.database, options)
.then(function () {
console.log("Conectou no banco Mongoose");
})
.catch(function (err) {
console.log("Erro ao abrir o servidor:\n\n" + err);
});
app.listen(secret.port, function () {
console.log("Server running on port " + secret.port);
});
consign()
.include('routes')
.into(app);
module.exports = app;