-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (18 loc) · 663 Bytes
/
app.js
File metadata and controls
25 lines (18 loc) · 663 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
25
var http = require('http');
var app = require('./config/express')();
var mongoose = require('mongoose');
mongoose.connect('mongodb://bulaapi:bulaapi@ds031982.mongolab.com:31982/bula', function(err){
if( err ) {
console.log("Error conectar mongo db: " + err);
} else {
console.log("Conexao realizada com sucesso!");
}
});
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function callback () {
console.log('Conexao realizada!');
});
http.createServer(app).listen(app.get('port'), function(){
console.log('Servidor rodando na porta ' + app.get('port'));
});