mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
Created users info page when viewing user data on user tab Added DB Procs to retrieve data for those components Added db auto initialize to the backend in preparation for docker images, this needs work as it still crashes if it cant connect to the db
34 lines
869 B
JavaScript
34 lines
869 B
JavaScript
// server.js
|
|
const express = require('express');
|
|
const cors = require('cors');
|
|
const apiRouter = require('./api');
|
|
const syncRouter = require('./sync');
|
|
const statsRouter = require('./stats');
|
|
const ActivityMonitor=require('./watchdog/ActivityMonitor');
|
|
const db = require("./db");
|
|
|
|
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3003;
|
|
const LISTEN_IP = '127.0.0.1';
|
|
|
|
app.use(express.json()); // middleware to parse JSON request bodies
|
|
app.use(cors());
|
|
|
|
app.use('/api', apiRouter); // mount the API router at /api
|
|
app.use('/sync', syncRouter); // mount the API router at /sync
|
|
app.use('/stats', statsRouter); // mount the API router at /stats
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server listening on http://${LISTEN_IP}:${PORT}`);
|
|
try{
|
|
db.initDB();
|
|
ActivityMonitor.ActivityMonitor(1000);
|
|
}catch(error)
|
|
{
|
|
console.log(error);
|
|
}
|
|
|
|
});
|