-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (29 loc) · 1016 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
39
const express = require("express");
const app = express();
require("dotenv").config();
const Sentry = require("@sentry/node");
const bodyParser = require("body-parser");
const cors = require("cors");
Sentry.init({
dsn: process.env.sentry_dsn,
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Sentry.Integrations.Express({ app }),
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations()
],
tracesSampleRate: 1.0
})
const router = require("./util/router");
const port = process.env.port;
app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());
app.use(cors({ origin: "*" }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.json());
app.engine("html", require("ejs").renderFile);
app.set("view engine", "ejs");
app.use("/", router);
app.use(Sentry.Handlers.errorHandler());
app.listen(port, () => {
console.log(`[API] Listening on Port: ${port}`);
})