Download server.js from HugVPS/node1: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/spaces/HugVPS/node1/resolve/88c2420a1d7ea4cf2c04f9fcdd772f8302a2edc0/server.js
- Command line
-
hf download hf://spaces/HugVPS/node1@88c2420a1d7ea4cf2c04f9fcdd772f8302a2edc0/server.js
-
curl -L -o server.js https://huggingface.co/spaces/HugVPS/node1/resolve/88c2420a1d7ea4cf2c04f9fcdd772f8302a2edc0/server.js
680 Bytes
| // server.js | |
| const express = require('express'); | |
| const { exec } = require('child_process'); | |
| const app = express(); | |
| const port = 7860; | |
| app.get('/run', (req, res) => { | |
| const command = req.query.command; | |
| if (!command) { | |
| return res.status(400).send('No command provided'); | |
| } | |
| exec(command, (error, stdout, stderr) => { | |
| if (error) { | |
| return res.status(500).send(`Error: ${error.message}`); | |
| } | |
| if (stderr) { | |
| return res.status(500).send(`Stderr: ${stderr}`); | |
| } | |
| res.send(`<pre>${stdout}</pre>`); | |
| }); | |
| }); | |
| app.listen(port, () => { | |
| console.log(`Server running at http://localhost:${port}`); | |
| }); |