Download server.js from srapi/hub: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/srapi/hub/resolve/main/server.js
- Command line
-
hf download hf://spaces/srapi/hub/server.js
-
curl -L -o server.js https://huggingface.co/spaces/srapi/hub/resolve/main/server.js
1.99 kB
| const express = require('express'); | |
| const path = require('path'); | |
| const app = express(); | |
| // تحديد المنفذ (Port) الخاص بـ Hugging Face وهو 7860 إلزامياً | |
| const PORT = process.env.PORT || 7860; | |
| // إرسال صفحة ترحيبية بسيطة عند فتح النطاق الرئيسي | |
| app.get('/', (req, res) => { | |
| res.send(` | |
| <!DOCTYPE html> | |
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>سرابي هب - Docker Space</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| background-color: #f0f2f5; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| margin: 0; | |
| } | |
| .container { | |
| text-align: center; | |
| background: white; | |
| padding: 30px; | |
| border-radius: 12px; | |
| box-shadow: 0 4px 6px rgba(0,0,0,0.1); | |
| } | |
| h1 { color: #333; } | |
| p { color: #666; font-size: 1.1em; } | |
| .status { color: #22c55e; font-weight: bold; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1>مرحباً بك في مستودع Hub 🚀</h1> | |
| <p>اسم المستخدم: <strong>srapi-hub</strong></p> | |
| <p>الحالة: <span class="status">يعمل بنجاح عبر Docker وبدون خطأ 404!</span></p> | |
| </div> | |
| </body> | |
| </html> | |
| `); | |
| }); | |
| // تشغيل الخادم والاستماع على المنفذ المطلوب والـ IP الشامل 0.0.0.0 | |
| app.listen(PORT, '0.0.0.0', () => { | |
| console.log(`Server is running on port ${PORT}`); | |
| }); | |