// 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 = `
Period | Big/Small | Color |
---|