Update server.js
Browse files
server.js
CHANGED
@@ -73,12 +73,7 @@ async function scrapeMatches() {
|
|
73 |
app.get("/draw", async (req, res) => {
|
74 |
try {
|
75 |
const matches = await scrapeMatches();
|
76 |
-
|
77 |
-
`{\n "homeTeam": "${match.homeTeam}",\n "awayTeam": "${match.awayTeam}",\n "stake": "${match.stake}",\n "prediction": "${match.prediction}",\n "score": "${match.score}"\n}`
|
78 |
-
).join("\n\n");
|
79 |
-
|
80 |
-
res.setHeader("Content-Type", "application/json");
|
81 |
-
res.send(`{\n\n${formattedMatches}\n\n}`);
|
82 |
} catch (error) {
|
83 |
console.error("Error:", error);
|
84 |
res.status(500).json({ success: false, message: "Failed to fetch data" });
|
|
|
73 |
app.get("/draw", async (req, res) => {
|
74 |
try {
|
75 |
const matches = await scrapeMatches();
|
76 |
+
res.json({ success: true, data: matches });
|
|
|
|
|
|
|
|
|
|
|
77 |
} catch (error) {
|
78 |
console.error("Error:", error);
|
79 |
res.status(500).json({ success: false, message: "Failed to fetch data" });
|