fresh start
This commit is contained in:
parent
c80ee1054b
commit
c297ad6085
26 changed files with 4578 additions and 243 deletions
42
server.js
Normal file
42
server.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import express from 'express';
|
||||
import path from 'path';
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
const distDir = path.resolve('dist');
|
||||
|
||||
app.use(express.static(distDir));
|
||||
|
||||
// For any route not matched by static files, serve index.html
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(distDir, 'index.html'));
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Server running at http://localhost:${port}`);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// // server.js (if Vite base is '/')
|
||||
// import http from 'http';
|
||||
// import path from 'path';
|
||||
// import handler from 'serve-handler';
|
||||
|
||||
// const port = process.env.PORT || 3000;
|
||||
|
||||
// const server = http.createServer((request, response) => {
|
||||
// return handler(request, response, {
|
||||
// public: 'dist',
|
||||
// cleanUrls: true, // <--- This was the missing line from your current server.js
|
||||
// rewrites: [
|
||||
// // For any path that doesn't match a static file, serve index.html
|
||||
// { source: '/**', destination: '/index.html' }
|
||||
// ]
|
||||
// });
|
||||
// });
|
||||
|
||||
// server.listen(port, () => {
|
||||
// console.log(`Frontend server running at http://localhost:${port}`);
|
||||
// });
|
||||
Loading…
Add table
Add a link
Reference in a new issue