-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
36 lines (28 loc) · 925 Bytes
/
server.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
const app = require('express')(),
request = require('request'),
cheerio = require('cheerio'),
mongoose = require('mongoose'),
agenda = require('agenda'),
config = require('config'),
// dbConfig = config.get('Dev.dbConfig')
PORT = process.env.PORT || 8080
Pool = require('./models/Pool').model;
mongoose.connect('mongodb://localhost/data/db/')
mongoose.Promise = global.Promise
const db = mongoose.connection
db.on('error', console.error.bind(console, 'connection error:'))
db.once('open', () => {
console.log("Connected to db at /data/db/")
})
app.get('/', (req,res)=>{
console.log('Request on the index.')
res.send('We wylin out.')
})
app.get('/forwarded', (req, res)=>{
console.log('forwarded was hit');
res.json({"msg":"we're gonna need a bigger port"});
});
app.listen(PORT, ()=>{
console.log(`Express listening on ${PORT}`)
console.log(`CTRL+C to kill process.`)
})