20 lines
615 B
JavaScript
20 lines
615 B
JavaScript
// backend/server.js
|
|
const express = require('express')
|
|
const dotenv = require('dotenv')
|
|
const metricsRouter = require('./routes/metrics')
|
|
|
|
dotenv.config()
|
|
const app = express()
|
|
const PORT = process.env.PORT || 3000
|
|
|
|
app.use(express.static('../frontend'))
|
|
app.use('/api', metricsRouter)
|
|
|
|
app.get('/api/logs', (req, res) => {
|
|
res.type('text/plain')
|
|
res.send(`2025-04-18T10:32:00Z [INFO] Server started on port ${PORT}\n2025-04-18T10:32:05Z [INFO] Connected to Qdrant\n2025-04-18T10:32:10Z [WARN] High CPU on S204\n`)
|
|
})
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`🚀 Dashboard backend running on port ${PORT}`)
|
|
}) |