17 lines
406 B
JavaScript
17 lines
406 B
JavaScript
const express = require('express');
|
|
|
|
const util = require('./util');
|
|
const realtime = require('./data/realtime');
|
|
|
|
const app = express();
|
|
const port = 4321;
|
|
|
|
app.get('/courses', async (req, res) =>
|
|
{
|
|
res.header('Access-Control-Allow-Origin', '*');
|
|
const courses = await realtime.getCourses();
|
|
return res.json(courses);
|
|
});
|
|
|
|
app.listen(port, () => console.log(`App listening on port ${port}`));
|