21 lines
491 B
JavaScript
21 lines
491 B
JavaScript
const express = require('express');
|
|
|
|
const util = require('./util');
|
|
const network = require('./data/network.json');
|
|
const realtime = require('./data/realtime');
|
|
|
|
const app = express();
|
|
const port = 3000;
|
|
|
|
app.use(express.static('dist'));
|
|
|
|
app.get('/courses', async (req, res) =>
|
|
{
|
|
const courses = await realtime.getCourses();
|
|
return res.json(courses);
|
|
});
|
|
|
|
app.get('/network', (req, res) => res.json(network));
|
|
|
|
app.listen(port, () => console.log(`App listening on port ${port}`));
|