|
|
|
@ -5,23 +5,23 @@ const app = express();
|
|
|
|
|
const port = process.env.PORT || 80;
|
|
|
|
|
|
|
|
|
|
// Servir les fichiers statiques depuis le dossier 'build'
|
|
|
|
|
app.use(express.static(path.join(__dirname, 'build')));
|
|
|
|
|
app.use(express.static(path.join(__dirname)));
|
|
|
|
|
|
|
|
|
|
// Définir le type MIME pour les fichiers JavaScript
|
|
|
|
|
app.use('/static/js', (req, res, next) => {
|
|
|
|
|
res.type('application/javascript; charset=utf-8');
|
|
|
|
|
next();
|
|
|
|
|
}, express.static(path.join(__dirname, 'build/static/js')));
|
|
|
|
|
}, express.static(path.join(__dirname, 'static/js')));
|
|
|
|
|
|
|
|
|
|
// Définir le type MIME pour les fichiers CSS
|
|
|
|
|
app.use('/static/css', (req, res, next) => {
|
|
|
|
|
res.type('text/css; charset=utf-8');
|
|
|
|
|
next();
|
|
|
|
|
}, express.static(path.join(__dirname, 'build/static/css')));
|
|
|
|
|
}, express.static(path.join(__dirname, 'static/css')));
|
|
|
|
|
|
|
|
|
|
// Route par défaut pour servir l'application React
|
|
|
|
|
app.get('*', (req, res) => {
|
|
|
|
|
res.sendFile(path.join(__dirname, 'build', 'index.html'));
|
|
|
|
|
res.sendFile(path.join(__dirname, 'index.html'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Démarrer le serveur
|
|
|
|
|