Update server.js
Browse files
server.js
CHANGED
@@ -3,7 +3,6 @@ const { chromium } = require("playwright-core");
|
|
3 |
const cheerio = require("cheerio");
|
4 |
const prettify = require("express-prettify"); // Auto-pretty JSON
|
5 |
const prettyjson = require("prettyjson"); // Human-readable formatting
|
6 |
-
const chalk = require("chalk"); // Colorful console output
|
7 |
|
8 |
const app = express();
|
9 |
const PORT = 7860;
|
@@ -76,8 +75,8 @@ app.get("/draw", async (req, res) => {
|
|
76 |
try {
|
77 |
const matches = await scrapeMatches();
|
78 |
|
79 |
-
// Beautify response
|
80 |
-
console.log(
|
81 |
console.log(prettyjson.render(matches));
|
82 |
|
83 |
res.json({
|
@@ -85,11 +84,11 @@ app.get("/draw", async (req, res) => {
|
|
85 |
data: matches
|
86 |
});
|
87 |
} catch (error) {
|
88 |
-
console.error(
|
89 |
res.status(500).json({ success: false, message: "Failed to fetch data" });
|
90 |
}
|
91 |
});
|
92 |
|
93 |
app.listen(PORT, () => {
|
94 |
-
console.log(
|
95 |
});
|
|
|
3 |
const cheerio = require("cheerio");
|
4 |
const prettify = require("express-prettify"); // Auto-pretty JSON
|
5 |
const prettyjson = require("prettyjson"); // Human-readable formatting
|
|
|
6 |
|
7 |
const app = express();
|
8 |
const PORT = 7860;
|
|
|
75 |
try {
|
76 |
const matches = await scrapeMatches();
|
77 |
|
78 |
+
// Beautify response (Console Output)
|
79 |
+
console.log("\nFetched Matches:");
|
80 |
console.log(prettyjson.render(matches));
|
81 |
|
82 |
res.json({
|
|
|
84 |
data: matches
|
85 |
});
|
86 |
} catch (error) {
|
87 |
+
console.error("Error fetching matches:", error);
|
88 |
res.status(500).json({ success: false, message: "Failed to fetch data" });
|
89 |
}
|
90 |
});
|
91 |
|
92 |
app.listen(PORT, () => {
|
93 |
+
console.log(`\nServer running at http://localhost:${PORT}/draw\n`);
|
94 |
});
|