-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
40 lines (32 loc) · 1.11 KB
/
server.js
File metadata and controls
40 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import express from 'express';
import cors from 'cors';
import helmet from 'helmet';
import dotenv from 'dotenv';
import { config } from './config/index.js';
import connectDB from './config/db.js';
import { errorHandler } from './middleware/errorMiddleware.js';
// Import Routes
import authRoutes from './routes/auth.js';
import contentRoutes from './routes/content.js';
import resumeRoutes from './routes/resume.js';
import analyticsRoutes from './routes/analytics.js';
dotenv.config();
connectDB();
const app = express();
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ limit: '50mb', extended: true }));
app.use(helmet());
app.use(cors({
origen: "http://localhost:5173",
credentials: true
}));
// API Routes
app.use('/api/auth', authRoutes);
app.use('/api/content', contentRoutes);
app.use('/api/resume', resumeRoutes);
app.use('/api/analytics', analyticsRoutes);
app.use(errorHandler);
app.listen(config.port, () => {
console.log(`🚀 Server running in ${config.env} mode on port ${config.port}`);
console.log(`🔗 Shadow Simulation active at: http://localhost:${config.port}/api/shadow`);
});