build 1
This commit is contained in:
27
backend/src/index.ts
Normal file
27
backend/src/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import { getDb } from './database';
|
||||
import { initScheduler } from './scheduler';
|
||||
import itemsRouter from './routes/items';
|
||||
import settingsRouter from './routes/settings';
|
||||
|
||||
const app = express();
|
||||
const PORT = parseInt(process.env.PORT || '3001', 10);
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
app.use('/api/items', itemsRouter);
|
||||
app.use('/api/settings', settingsRouter);
|
||||
|
||||
app.get('/api/health', (_req, res) => {
|
||||
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
// Boot sequence
|
||||
getDb();
|
||||
initScheduler();
|
||||
|
||||
app.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`[Server] UI Tracker backend running on port ${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user