-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
48 lines (38 loc) · 870 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
40
41
42
43
44
45
46
47
48
const express = require('express');
const yr = require('./yr.js');
const fotball = require('./fotball.js');
const ruter = require('./ruter.js');
const app = express();
app.set('port', (process.env.PORT || 5000));
app.get('/', (req, res) => {
res.json({
messages: [
{text: "Dette er en svarmelding!"}
]
});
});
app.get('/yr/idag', (req, res) => {
yr(res);
});
app.get('/yr/imorgen', (req, res) => {
yr(res, true);
});
app.get('/fotball', (req, res) => {
if (req.query.lag) {
fotball(res, req.query.lag);
} else {
fotball(res);
}
});
app.get('/ruter/buss', (req, res) => {
ruter.buss(res);
});
app.get('/ruter/trikk', (req, res) => {
ruter.trikk(res);
});
app.get('/ruter/tog', (req, res) => {
ruter.tog(res);
});
app.listen(app.get('port'), () => {
console.log('Tenkbot-API is running on port', app.get('port'));
});