hub / server.js
srapi's picture
Create server.js
1631edb verified
Raw History Blame Contribute Delete
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}`);
});