-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (32 loc) · 1.06 KB
/
app.js
File metadata and controls
40 lines (32 loc) · 1.06 KB
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
const poles = require('./endpoints/poles');
const fp = require('./endpoints/finalparty');
const express = require("express");
const app = express();
const port = process.env.PORT || 3001;
app.get("/", (req, res) => {
res.redirect('https://galbadia.garden/api');
});
app.get("/poles", (req, res) => res.type('html').send(noInputError));
app.get("/party", (req, res) => res.type('html').send(noInputError));
app.get("/poles/:pattern", (req, res) => {
let response = "ERROR";
if(!req.params.pattern) {
response = noInputError;
} else {
response = poles.GetPoles(req.params.pattern);
}
res.send(response);
});
app.get("/party/:pattern", (req, res) => {
let response = "ERROR";
if(!req.params.pattern) {
response = noInputError;
} else {
response = fp.GetFinalParty(req.params.pattern);
}
res.send(response);
});
const server = app.listen(port, () => console.log(`App listening on port ${port}!`));
server.keepAliveTimeout = 120 * 1000;
server.headersTimeout = 120 * 1000;
const noInputError = "Input vas not specified!! Odine vants to know WHY?!";