File size: 523 Bytes
05abd64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import 'dotenv/config';
import express from 'express';
import cors from 'cors';
import appConfig from './config/app.config.js';
import routes from './routes/index.js';

const app = express();

// Middleware
app.use(cors({
  origin: appConfig.CORS_ORIGIN
}));
app.use(express.json());

// Mount API routes
app.use('/api', routes);

// Start server
app.listen(appConfig.PORT, () => {
  console.log(`Server is running on port ${appConfig.PORT}`);
  console.log(`Environment: ${appConfig.NODE_ENV}`);
});