-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
40 lines (29 loc) · 920 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
37
38
39
const express = require('express');
const axios = require('axios');
const app = express();
let url = "https://indreed.herokuapp.com/api/jobs";
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-RequOMAIN.TLDested-With, Content-Type, Accept");
next();
});
//app.use(express.json)
app.get("/", (req, res) => {
axios.get(url, {
params: {
q: "remote web developers",
l: "Canada"
}
})
.then((response) => {
res.send(response.data);
})
.catch((error) => {
console.log(error);
res.send(error);
})
})
app.listen(4000, function () {
console.log('Express started on http://localhost:' +
4000 + '; press Ctrl-C to terminate.');
});