replacing serve with express
This commit is contained in:
parent
efc6766860
commit
c49d730a3b
3 changed files with 12710 additions and 1 deletions
12692
package-lock.json
generated
Normal file
12692
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"dotenv": "^16.4.7",
|
||||
"express": "^4.21.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1"
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
16
server.js
Normal file
16
server.js
Normal 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}`);
|
||||
});
|
||||
Loading…
Reference in a new issue