18 lines
480 B
JavaScript
18 lines
480 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
|
|
const app = express();
|
|
const port = process.env.PORT || 4001;
|
|
|
|
// Servir les fichiers statiques du build
|
|
app.use(express.static(path.join(__dirname, 'dist')));
|
|
|
|
// Pour toutes les autres routes, renvoyer index.html (Vue Router history mode)
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
|
|
});
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Server running on port ${port}`);
|
|
});
|