replacing serve with express

This commit is contained in:
2ManyProjects 2025-03-26 22:45:44 -05:00
parent efc6766860
commit c49d730a3b
3 changed files with 12710 additions and 1 deletions

12692
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"express": "^4.21.2",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-scripts": "5.0.1" "react-scripts": "5.0.1"
@ -27,7 +28,7 @@
], ],
"development": [ "development": [
"last 1 chrome version", "last 1 chrome version",
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
} }

16
server.js Normal file
View file

@ -0,0 +1,16 @@
const express = require('express');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 3888;
// Serve static files from the React build
app.use(express.static(path.join(__dirname, 'build')));
// Serve index.html for all routes to support client-side routing
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server running on port ${PORT}`);
});