2020-01-13 11:20:35 +00:00
|
|
|
const express = require('express');
|
|
|
|
|
2020-07-17 14:40:09 +00:00
|
|
|
const util = require('./util');
|
2020-01-15 23:34:47 +00:00
|
|
|
const network = require('./data/network.json');
|
2020-07-17 14:40:09 +00:00
|
|
|
const realtime = require('./data/realtime');
|
2020-01-13 11:20:35 +00:00
|
|
|
|
|
|
|
const app = express();
|
|
|
|
const port = 3000;
|
|
|
|
|
2020-01-13 11:39:28 +00:00
|
|
|
app.use(express.static('dist'));
|
2020-01-13 11:20:35 +00:00
|
|
|
|
2020-07-17 14:40:09 +00:00
|
|
|
app.get('/courses', async (req, res) =>
|
2020-01-13 11:20:35 +00:00
|
|
|
{
|
2020-07-17 14:40:09 +00:00
|
|
|
const courses = await realtime.getCourses();
|
|
|
|
return res.json(courses);
|
2020-01-14 13:08:08 +00:00
|
|
|
});
|
2020-01-13 11:20:35 +00:00
|
|
|
|
2020-07-17 14:40:09 +00:00
|
|
|
app.get('/network', (req, res) => res.json(network));
|
2020-01-13 11:20:35 +00:00
|
|
|
|
2020-01-15 23:34:47 +00:00
|
|
|
app.listen(port, () => console.log(`App listening on port ${port}`));
|