-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
36 lines (27 loc) · 866 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
/**
* Created by arjunrajpal on 23/04/17.
*/
var express = require('express')
var cheerio = require('cheerio')
var bodyParser = require('body-parser')
var logger = require('morgan')
var path = require('path')
console.log("Server running");
var app = express()
var api = require('./api')
app.use('/api',api);
//Body-Parser Setup
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
//Database
var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
// mongoose.connect('mongodb://localhost:27017/test');
mongoose.connect('mongodb://admin:[email protected]:37947/webapp_instalocate');
app.use(logger('dev'));
app.use(express.static(path.join(__dirname,'/views')));
app.get('/',function (req,res) {
res.sendFile("views/index.html")
});
app.set('port',(process.env.PORT || 2000));
app.listen(app.get('port'));