Created
August 6, 2025 01:12
-
-
Save pdaug/6e379c37a33d1b87f913a2dacc0068b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from "path"; | |
import express from "express"; | |
import { createServer as createViteServer } from "vite"; | |
import { createServer } from "./index.js"; | |
const app = createServer(); | |
const staticPath = path.join(process.cwd(), "dist", "spa"); | |
const vite = await createViteServer({ | |
root: staticPath, | |
server: { middlewareMode: "html" }, | |
}); | |
app.use(vite.middlewares); | |
const PORT = process.env.PORT || 3000; | |
app.listen(PORT, "0.0.0.0", () => { | |
console.log(`๐ Production server running on port ${PORT}`); | |
console.log(`๐ Environment: ${process.env.NODE_ENV}`); | |
console.log( | |
`๐พ Database: ${process.env.DATABASE_URL ? "Connected" : "No URL set"}`, | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment