Spaces:
Sleeping
Sleeping
| const express = require('express'); | |
| const app = express(); | |
| const PORT = 7860; | |
| // ১. হোম রাউট (এটি থাকলে ড্যাশবোর্ড থেকে ক্লিক করলে আর ৪0৪ আসবে না) | |
| app.get('/', (req, res) => { | |
| res.send("<h1>Server is Running!</h1><p>Adsgram Reward Server is Live.</p>"); | |
| }); | |
| // ২. Adsgram রিওয়ার্ড রাউট (যেটি আপনার আসল কাজের জন্য) | |
| app.get('/reward', (req, res) => { | |
| const userId = req.query.userid; | |
| if (userId) { | |
| console.log(`Success: Reward signal received for User: ${userId}`); | |
| // এখানে পরে আমরা ডাটাবেস আপডেট করার কোড যোগ করব | |
| return res.status(200).send("OK"); | |
| } | |
| return res.status(400).send("Error: No UserID provided"); | |
| }); | |
| // ৩. পোর্ট সেটিংস (Hugging Face এর জন্য এটি এভাবেই থাকতে হবে) | |
| app.listen(PORT, '0.0.0.0', () => { | |
| console.log(`Server is listening on port ${PORT}`); | |
| }); | |