mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-18 19:19:36 +02:00
Added WebSockets with funcionality to send messages from any module
This commit is contained in:
parent
4510a709d4
commit
38f5d3b66a
7 changed files with 84 additions and 21 deletions
21
api.js
Normal file
21
api.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const express = require('express');
|
||||
const errorHandler = require('./middleware/errorHandler');
|
||||
|
||||
const api = express();
|
||||
|
||||
api.get('/', (req, res) => {
|
||||
res.send('Server is working');
|
||||
})
|
||||
|
||||
// Body parser
|
||||
api.use(express.json());
|
||||
|
||||
// Link controllers with routes
|
||||
api.use('/api/apps', require('./routes/apps'));
|
||||
api.use('/api/config', require('./routes/config'));
|
||||
api.use('/api/weather', require('./routes/weather'));
|
||||
|
||||
// Custom error handler
|
||||
api.use(errorHandler);
|
||||
|
||||
module.exports = api;
|
Loading…
Add table
Add a link
Reference in a new issue