yasd/apps/server/webserver/WebServer.js

30 lines
627 B
JavaScript
Raw Normal View History

2022-04-29 11:21:51 -04:00
const EVENTS = require('../lib/Events');
const express = require('express');
const cors = require('cors');
const app = express();
const port = 8899;
const api = require('./api/routes');
function init(){
eventBus.on(EVENTS.CONFIG_READY, config => {
});
eventBus.on(EVENTS.CONFIG_CHANGED, newConfig => {
console.log("Config changed event received in WEB");
});
app.use(cors());
app.use(express.json())
app.use('/api', api)
app.get('/', (req, res) => {
res.sendStatus(200);
});
app.listen(port, () => {
console.log(`Stream deck server listening on port ${port}`);
});
}
module.exports = {init}