forked from SquadcastHub/Squadcast-Webhook-Connectors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
59 lines (53 loc) · 2.09 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// IMPORTS
const express = require("express");
const cors = require("cors");
const https = require("https");
const fs = require("fs")
// DEFINING ENVIRONMENT CONFIG
require("dotenv").config();
const app = express();
app.use(cors());
app.use(express.json());
//OPTIONS
const options = {
key: fs.readFileSync("./certs/private-key.pem"),
cert: fs.readFileSync("./certs/public-cert.pem")
};
// AUTH KEY GENERATION
const authV1 = require("./middlewares/v1/auth");
console.log("\nauthKey : "+authV1.generate());
// ROUTES
const slackRouter = require("./routes/api/slack");
app.use('/squadcast/connector', slackRouter);
const emailRouter = require("./routes/api/email");
app.use('/squadcast/connector', emailRouter);
const trelloRouter = require("./routes/api/trello");
app.use('/squadcast/connector', trelloRouter);
const clickUpRouter = require("./routes/api/clickUp");
app.use('/squadcast/connector', clickUpRouter);
const discordRouter = require("./routes/api/discord");
app.use('/squadcast/connector', discordRouter);
if( process.env.initializeLinearClient.toLowerCase() == "yes") {
const linearRouter = require("./routes/api/linear");
app.use('/squadcast/connector', linearRouter);
}
if( process.env.telegram_bot_start.toLowerCase() == "yes") {
const telegramRouter = require("./routes/api/telegram");
app.use('/squadcast/connector', telegramRouter);
}
const mattermostRouter = require("./routes/api/mattermost");
app.use('/squadcast/connector', mattermostRouter);
const rapid7Router = require("./routes/api/rapid7");
app.use('/squadcast/connector/update-escalation', rapid7Router);
const serviceNowRouter = require("./routes/api/serviceNow");
app.use('/squadcast/connector', serviceNowRouter);
const zulipRouter = require("./routes/api/zulip");
app.use('/squadcast/connector', zulipRouter);
const updatetag = require("./routes/api/updatetag");
app.use('/squadcast/connector', updatetag);
// HTTPS SERVER
const port = process.env.PORT;
app.listen(port);
// https.createServer(options, app).listen(port, () => {
// console.log("Squadcast - Webhooks - Connectors - HTTPS Server is running on port:" + port);
// });