Download server.js from p4cng/quangen: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/spaces/p4cng/quangen/resolve/main/server.js
- Command line
-
hf download hf://spaces/p4cng/quangen/server.js
-
curl -L -o server.js https://huggingface.co/spaces/p4cng/quangen/resolve/main/server.js
715 Bytes
| import express from "express"; | |
| import path from "path"; | |
| import { fileURLToPath } from "url"; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); | |
| const app = express(); | |
| const PORT = process.env.PORT || 7860; | |
| // Serve static files (index.html, style.css, etc.) | |
| app.use(express.static(__dirname)); | |
| // Example API route | |
| app.get("/api/hello", (req, res) => { | |
| res.json({ message: "Hello from Quantum Genesis Frontier!" }); | |
| }); | |
| // Default route — serve index.html | |
| app.get("*", (req, res) => { | |
| res.sendFile(path.join(__dirname, "index.html")); | |
| }); | |
| // Start server | |
| app.listen(PORT, "0.0.0.0", () => { | |
| console.log(`🚀 Server running on http://0.0.0.0:${PORT}`); | |
| }); | |