tracktracker/back/index.js

21 lines
491 B
JavaScript
Raw Normal View History

2020-01-13 11:20:35 +00:00
const express = require('express');
const util = require('./util');
2020-01-15 23:34:47 +00:00
const network = require('./data/network.json');
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
app.get('/courses', async (req, res) =>
2020-01-13 11:20:35 +00:00
{
const courses = await realtime.getCourses();
return res.json(courses);
});
2020-01-13 11:20:35 +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}`));