forked from scotch-io/node-web-scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
25 lines (19 loc) · 845 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
const express = require('express');
const app = express();
const { parseRequestFromTemplate } = require('./utils/parser');
const {
schoolShootings,
massShootingsPre2018,
massShootings2018,
massShootings2019,
} = require('./templates/wikipedia');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/wikipedia-school-shootings', parseRequestFromTemplate(schoolShootings));
app.get('/wikipedia-mass-shootings-pre-2018', parseRequestFromTemplate(massShootingsPre2018));
app.get('/wikipedia-mass-shootings-2018', parseRequestFromTemplate(massShootings2018));
app.get('/wikipedia-mass-shootings-2019', parseRequestFromTemplate(massShootings2019));
exports = module.exports = app;