Spaces:
Sleeping
Sleeping
| import express from 'express'; | |
| import cors from 'cors'; | |
| import dotenv from 'dotenv'; | |
| import authRoutes from './routes/auth'; | |
| dotenv.config(); | |
| const app = express(); | |
| const PORT = process.env.PORT || 5000; | |
| app.use(cors({ | |
| origin: 'http://localhost:5173', // Vite React local dev port | |
| credentials: true | |
| })); | |
| app.use(express.json()); | |
| // Routes | |
| app.use('/api/auth', authRoutes); | |
| // Health check | |
| app.get('/health', (req, res) => { | |
| res.json({ status: 'OK', timestamp: new Date() }); | |
| }); | |
| app.listen(PORT, () => { | |
| console.log(`๐ API Server running on http://localhost:${PORT}`); | |
| }); | |