| // server.js | |
| import express from 'express' | |
| import path from 'path' | |
| import { fileURLToPath } from 'url' | |
| const app = express() | |
| const PORT = process.env.PORT || 7860 | |
| const __filename = fileURLToPath(import.meta.url) | |
| const __dirname = path.dirname(__filename) | |
| // Serve arquivos da build do React | |
| app.use(express.static(path.join(__dirname, 'dist'))) | |
| app.get('*', (req, res) => { | |
| res.sendFile(path.join(__dirname, 'dist', 'index.html')) | |
| }) | |
| app.listen(PORT, () => { | |
| console.log(`Servidor rodando na porta ${PORT}`) | |
| }) | |