51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import 'dotenv/config'
|
|
import express from 'express'
|
|
import cors from 'cors'
|
|
import path from 'path'
|
|
import proxmox from './routes/proxmox'
|
|
import synology from './routes/synology'
|
|
import adguard from './routes/adguard'
|
|
import crowdsec from './routes/crowdsec'
|
|
import headscale from './routes/headscale'
|
|
import fritzbox from './routes/fritzbox'
|
|
import authentik from './routes/authentik'
|
|
import vaultwarden from './routes/vaultwarden'
|
|
import kuma from './routes/kuma'
|
|
import arr from './routes/arr'
|
|
import qbt from './routes/qbittorrent'
|
|
import jellyfin from './routes/jellyfin'
|
|
import navidrome from './routes/navidrome'
|
|
import romm from './routes/romm'
|
|
import weather from './routes/weather'
|
|
|
|
const app = express()
|
|
const PORT = Number(process.env.PORT ?? 3001)
|
|
|
|
app.use(cors())
|
|
app.use(express.json())
|
|
|
|
app.use('/api/proxmox', proxmox)
|
|
app.use('/api/synology', synology)
|
|
app.use('/api/adguard', adguard)
|
|
app.use('/api/crowdsec', crowdsec)
|
|
app.use('/api/headscale', headscale)
|
|
app.use('/api/fritzbox', fritzbox)
|
|
app.use('/api/authentik', authentik)
|
|
app.use('/api/vaultwarden', vaultwarden)
|
|
app.use('/api/kuma', kuma)
|
|
app.use('/api/arr', arr)
|
|
app.use('/api/qbt', qbt)
|
|
app.use('/api/jellyfin', jellyfin)
|
|
app.use('/api/navidrome', navidrome)
|
|
app.use('/api/romm', romm)
|
|
app.use('/api/weather', weather)
|
|
|
|
// Serve built frontend in production only
|
|
if (process.env.NODE_ENV === 'production') {
|
|
const distPath = path.join(__dirname, '..', 'dist')
|
|
app.use(express.static(distPath))
|
|
app.get('*', (_req, res) => res.sendFile(path.join(distPath, 'index.html')))
|
|
}
|
|
|
|
app.listen(PORT, () => console.log(`Dashboard server running on http://localhost:${PORT}`))
|