33 lines
864 B
Plaintext
33 lines
864 B
Plaintext
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;
|