Spaces:
Paused
Paused
Download server.js from rabinmg821/ui-components: direct link, hf CLI and curl.
- Browser
- Download file 659 Bytes
-
https://huggingface.co/spaces/rabinmg821/ui-components/resolve/main/server.js
- Command line
-
hf download hf://spaces/rabinmg821/ui-components/server.js
-
curl -L -o server.js https://huggingface.co/spaces/rabinmg821/ui-components/resolve/main/server.js
659 Bytes
| const express = require('express'); | |
| const { createProxyMiddleware } = require('http-proxy-middleware'); | |
| const path = require('path'); | |
| const app = express(); | |
| const port = 7860; | |
| const targetUrl = 'http://91.107.248.81:8080'; | |
| app.use(express.static(path.join(__dirname, 'public'))); | |
| app.use('/api/v1/sync', createProxyMiddleware({ | |
| target: targetUrl, | |
| changeOrigin: true, | |
| ws: true, | |
| logLevel: 'silent', | |
| onError: (err, req, res) => { | |
| res.status(500).json({ error: "Internal Service Error" }); | |
| } | |
| })); | |
| app.get('/health', (req, res) => { | |
| res.status(200).json({ status: "active", version: "1.0.2" }); | |
| }); | |
| app.listen(port); |