This commit is contained in:
2025-06-11 22:04:42 -03:00
2 changed files with 2 additions and 2 deletions

View File

@@ -1,19 +0,0 @@
import { Router } from 'express';
import multer from 'multer';
import OrphanagesController from './controllers/OrphanagesController';
import UploadConfig from './config/upload';
const routes = Router();
const upload = multer(UploadConfig);
routes.get('/users', (request, response) => {
return response.json({message: ["João"]});
});
routes.post('/orphanages', upload.array('images'), OrphanagesController.create);
routes.get('/orphanages', OrphanagesController.getAll);
routes.get('/orphanages/:id', OrphanagesController.getIndex);
export default routes;

View File

@@ -1,26 +0,0 @@
import 'dotenv/config';
import express from 'express';
import path from 'path';
import 'express-async-errors';
import cors from 'cors';
import './database/connection';
import errorHandler from './errors/handler';
import routes from './routes';
const app = express();
app.use(cors());
app.use(express.json());
app.use('/api', routes);
const uploadsPath = path.join(process.cwd(), 'uploads');
app.use('/uploads', express.static(uploadsPath));
app.use(routes);
app.use(errorHandler);
app.listen(process.env.PORT || 3101, () => {
console.log(`Serving static files for /uploads from: ${uploadsPath}`);
console.log('Server is running on http://localhost:' + (process.env.PORT || 3101));
console.log('Environment:', process.env.NODE_ENV || 'development');
});