first commit
This commit is contained in:
32
backend/src/index.ts
Normal file
32
backend/src/index.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import authRouter from './routes/auth';
|
||||
import performanceRouter from './routes/performance';
|
||||
import statisticsRouter from './routes/statistics';
|
||||
import configRouter from './routes/config';
|
||||
import employeeRouter from './routes/employee';
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
app.get('/health', (_req, res) => {
|
||||
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
app.use('/api/user', authRouter);
|
||||
app.use('/api/performance', performanceRouter);
|
||||
app.use('/api/statistics', statisticsRouter);
|
||||
app.use('/api/config', configRouter);
|
||||
app.use('/api/employee', employeeRouter);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user