-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (24 loc) · 829 Bytes
/
index.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
const express = require('express');
const app = express();
const dotenv = require('dotenv');
const bodyParser = require('body-parser');
const db = require('./db');
const scrape = require('./helpers/pagerequest');
dotenv.config(); // initialize the the env setup
//parse request for content-type = application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({extended: true}))
//parse requests of content-type - application/json
app.use(bodyParser.json())
db.connectDB(`${process.env.CONNECTION_URL}`).then(async ()=>{
app.listen(err=>{
if(err){
return console.log(err);
}
console.log(`${process.env.DATABASE_NAME}`);
console.log(`Server listening on port -> ${process.env.PORT}`);
//scrape.scrapePage();
});
})
.catch((err)=>{
console.log(err);
});