feat: setup docker, backend, and gitea pipeline for production
All checks were successful
Build and Deploy / build-and-push (push) Successful in 4m19s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 4m19s
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const path = require('path');
|
||||
const pool = require('./db');
|
||||
|
||||
const app = express();
|
||||
const PORT = 3001; // Porta do backend
|
||||
const PORT = process.env.PORT || 3001; // Porta do backend
|
||||
|
||||
app.use(cors()); // Permite que o React (localhost:3000) acesse este servidor
|
||||
app.use(express.json());
|
||||
|
||||
// Serve static files from the React app
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
app.use(express.static(path.join(__dirname, '../dist')));
|
||||
}
|
||||
|
||||
// --- Rotas de Usuários ---
|
||||
|
||||
// Listar Usuários (com filtro opcional de tenant)
|
||||
@@ -124,6 +130,12 @@ app.get('/api/tenants', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Serve index.html for any unknown routes (for client-side routing)
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../dist/index.html'));
|
||||
});
|
||||
}
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🚀 Servidor Backend rodando em http://localhost:${PORT}`);
|
||||
|
||||
Reference in New Issue
Block a user