// server.js const express = require("express"); const cors = require("cors"); const app = express(); const PORT = process.env.PORT || 3000; app.use(cors()); // === Signals Setup === const bigSmallSignals = [ { text: "Big", color: "yellow" }, { text: "Small", color: "cyan" } ]; const colorSignals = [ { text: "Red", color: "red" }, { text: "Green", color: "lime" }, { text: "Violet", color: "violet" } ]; let history = []; // সব history এখানে সেভ হবে let currentResult = null; // বর্তমান result let countdown = 30; // global countdown // === Random Result Generator === function generateResult() { const pickBigSmall = bigSmallSignals[Math.floor(Math.random() * bigSmallSignals.length)]; const pickColor = colorSignals[Math.floor(Math.random() * colorSignals.length)]; const period = Date.now(); return { period, bigSmall: pickBigSmall, color: pickColor }; } // === Countdown Timer (Global) === setInterval(() => { countdown--; if (countdown <= 0) { // নতুন result বানানো হবে currentResult = generateResult(); // history তে push history.unshift(currentResult); if (history.length > 50) history.pop(); // ৫০ টার বেশি হলে পুরোনো গুলো মুছে দেবে countdown = 30; // reset হবে কিন্তু global clock একটাই } }, 1000); // প্রথমবার একটা result বানানো currentResult = generateResult(); history.unshift(currentResult); // === Frontend HTML === const htmlPage = ` ⚡ WinGo 30s Market ⚡

⚡ WinGo 30s Market ⚡

--
Next Signal Coming Soon...

Next Signal Coming Soon...

📜 Result History

Period Big/Small Color
`; // === Routes === app.get("/", (req, res) => { res.send(htmlPage); }); app.get("/api/data", (req, res) => { res.json({ countdown, currentResult, history }); }); // === Start Server === app.listen(PORT, () => { console.log("✅ Server running on http://localhost:" + PORT); });