2020-09-01 23:19:30 +00:00
|
|
|
const express = require('express');
|
|
|
|
const eventRouter = require('./event.js').router;
|
|
|
|
const port = require('./config.js').port;
|
|
|
|
const appRouter = require('./app.js').router;
|
2020-09-15 14:31:58 +00:00
|
|
|
const cors = require('cors');
|
2020-08-30 20:42:50 +00:00
|
|
|
|
|
|
|
const app = express();
|
|
|
|
app.use(express.json());
|
2020-09-15 14:31:58 +00:00
|
|
|
app.use(cors()); // TODO: Enable this for event creation only
|
2020-08-30 20:42:50 +00:00
|
|
|
|
2020-09-15 14:31:58 +00:00
|
|
|
// app.get('/id', (req, res) => {
|
|
|
|
// const length = Number.parseInt(req.query['length']) || 32;
|
|
|
|
// res.send(require('./util.js').randomId(length));
|
|
|
|
// });
|
2020-08-30 20:42:50 +00:00
|
|
|
|
2020-09-15 14:31:58 +00:00
|
|
|
app.use(express.static('server/static'));
|
|
|
|
app.use('/api/apps', appRouter);
|
|
|
|
app.use('/api/events', eventRouter);
|
2020-08-30 20:42:50 +00:00
|
|
|
|
|
|
|
app.listen(port, () => {
|
|
|
|
console.log(`Started Flayre server on port ${port}`);
|
2020-09-01 16:13:40 +00:00
|
|
|
});
|