Download server.js from NexusV1/bsvp: direct link, hf CLI and curl.
- Browser
- Download file 662 Bytes
-
https://huggingface.co/spaces/NexusV1/bsvp/resolve/main/server.js
- Command line
-
hf download hf://spaces/NexusV1/bsvp/server.js
-
curl -L -o server.js https://huggingface.co/spaces/NexusV1/bsvp/resolve/main/server.js
662 Bytes
| const express = require("express"); | |
| const { spawn } = require("child_process"); | |
| const path = require("path"); | |
| const app = express(); | |
| // Define the bot directory | |
| const botDirectory = path.join(__dirname, "bot"); | |
| // Start the bot in the background | |
| const botProcess = spawn("node", ["app.js"], { | |
| cwd: botDirectory, | |
| stdio: "inherit", | |
| }); | |
| app.get("/", (req, res) => { | |
| res.send("hello"); | |
| }); | |
| // Handle process exit | |
| process.on("exit", () => { | |
| botProcess.kill(); | |
| }); | |
| process.on("SIGINT", () => { | |
| botProcess.kill(); | |
| process.exit(); | |
| }); | |
| const PORT = 7860; | |
| app.listen(PORT, "0.0.0.0", () => { | |
| console.log(`Server running on http://0.0.0.0:${PORT}`); | |
| }); |