This commit updates the project's dependencies, including React, Recharts, and Lucide React, to their latest stable versions. It also introduces a `server.js` file to handle static file serving with Express for better production deployment. Additionally, TypeScript and Vite configurations have been refined for improved build performance and type safety.
23 lines
625 B
JavaScript
23 lines
625 B
JavaScript
|
|
import express from 'express';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 8080;
|
|
|
|
// Servir os arquivos estáticos da pasta 'dist' gerada pelo build do Vite
|
|
app.use(express.static(path.join(__dirname, 'dist')));
|
|
|
|
// Redirecionar todas as rotas para o index.html (suporte a SPA)
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Servidor rodando na porta ${PORT}`);
|
|
});
|