fresh start
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
Bhavnoor Singh Saroya 2025-08-25 12:41:18 -07:00
parent c80ee1054b
commit c297ad6085
26 changed files with 4578 additions and 243 deletions

42
server.js Normal file
View 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}`);
// });