Refactor code structure and remove redundant sections for improved readability and maintainability

This commit is contained in:
2025-06-11 18:48:20 -03:00
parent 2f6eb4f6c1
commit f9c1ece4f0
6 changed files with 4 additions and 4 deletions

22
backend/server.ts Normal file
View File

@@ -0,0 +1,22 @@
import 'dotenv/config';
import express from 'express';
import path from 'path';
import 'express-async-errors';
import cors from 'cors';
import './src/database/connection'; // This line now automatically runs the connection
import errorHandler from './src/errors/handler';
import routes from './routes';
const app = express();
app.use(cors());
app.use(express.json());
app.use('/uploads', express.static(path.join(__dirname, '..', 'uploads')));
app.use(routes);
app.use(errorHandler);
app.listen(process.env.PORT || 3101, () => {
console.log('Server is running on http://localhost:' + (process.env.PORT || 3101));
console.log('Environment:', process.env.NODE_ENV || 'development');
});