tracktracker/back/index.js

17 lines
406 B
JavaScript
Raw Normal View History

2020-01-13 11:20:35 +00:00
const express = require('express');
const util = require('./util');
const realtime = require('./data/realtime');
2020-01-13 11:20:35 +00:00
const app = express();
const port = 4321;
2020-01-13 11:20:35 +00:00
app.get('/courses', async (req, res) =>
2020-01-13 11:20:35 +00:00
{
res.header('Access-Control-Allow-Origin', '*');
const courses = await realtime.getCourses();
return res.json(courses);
});
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}`));