-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
32 lines (26 loc) · 909 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
// app.js
const express = require('express');
const bodyParser = require('body-parser');
const urlinfo = require('./routes/urlinfo.route'); // Imports routes for the products
// initialize our express app
const app = express();
const mongoose = require('mongoose');
let dev_db_url = 'mongodb://sampleuser:[email protected]:23584/urlinfos';
let mongoDB = process.env.MONGODB_URI || dev_db_url;
mongoose.connect(mongoDB)//, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
let db = mongoose.connection;
db.on('error',(err)=>{
console.log(err)
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(function(req, res, next){
require("./controllers/urlinfo.controller.js").urlinfo_monitor();
next()
});
app.use('/', urlinfo);
let port = 1234;
app.listen(port, () => {
console.log('Server is up and running on port numner ' + port);
});