-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (30 loc) · 968 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
32
33
34
35
36
37
38
const config = require("./config");
const express = require("express");
const app = express();
const oauth = require("./lib/routes/oauth");
const bodyParser = require("body-parser");
const getCompanyCode = require("./lib/routes/getCompanyCode");
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.get("/api/1/healthcheck", function(req, res) {
logger.debug(req.query);
db.validateConnection()
.then(() => {
res.send("200 OK");
})
.catch(err => {
res.status(503).send("503");
});
});
app.get("/", function(req, res) {
res.sendFile(`${process.cwd()}/static/html/linkedin.html`);
});
app.use("/oauth", oauth);
app.use("/getCSV", function(req, res) {
res.sendFile(`${process.cwd()}/static/html/getCSV.html`);
});
app.use("/css/stylesheet.css", function(req, res) {
res.sendFile(`${process.cwd()}/static/css/stylesheet.css`);
});
app.use("/returnCSV", getCompanyCode);
app.listen(config.port);