-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (25 loc) · 856 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
'use strict';
let express = require('express');
let path = require('path');
let logger = require('morgan');
let bodyParser = require('body-parser');
let app = express();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
//app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(path.join(__dirname, 'public')));
let requests = require('./controllers/requests');
let db = require('./db');
app.use('/',requests);
const PORT = 9000;
const MONGODBURL = 'mongodb://arquitecturasoftware:12345678a@ds129374.mlab.com:29374/tarea1';
db.connect(MONGODBURL, function(err) {
if (err) {
console.log('Unable to connect to Mongo.');
process.exit(1);
} else {
app.listen(PORT, () => console.log("Servidor creado"));
}
});