From ecd5d8542e6aefa9ad8fbf31a5688d18f9ccad2e Mon Sep 17 00:00:00 2001 From: 65160111 <65160111@go.buu.ac.th> Date: Mon, 17 Mar 2025 17:48:44 +0700 Subject: [PATCH] Initial commit --- .gitignore | 4 ++++ public/script.js | 2 +- routes/reports.js | 4 ++-- server.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e69de29..cc16246 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +.env +uploads +*.log diff --git a/public/script.js b/public/script.js index 62f3dc2..428a844 100644 --- a/public/script.js +++ b/public/script.js @@ -1,4 +1,4 @@ -const API_URL = "http://localhost:5000/api"; +const API_URL = "http://localhost:8080/api"; // 🔹 Login function login() { diff --git a/routes/reports.js b/routes/reports.js index f66735d..7f9708b 100644 --- a/routes/reports.js +++ b/routes/reports.js @@ -75,7 +75,7 @@ router.get("/", authMiddleware, (req, res) => { results.forEach(report => { if (report.image_url) { - report.image_url = `http://localhost:5000${report.image_url}`; + report.image_url = `http://localhost:8080${report.image_url}`; } }); @@ -102,7 +102,7 @@ router.get("/:id", authMiddleware, (req, res) => { const report = results[0]; if (report.image_url) { - report.image_url = `http://localhost:5000${report.image_url}`; + report.image_url = `http://localhost:8080 ${report.image_url}`; } res.json(report); diff --git a/server.js b/server.js index ea1302e..ee77f02 100644 --- a/server.js +++ b/server.js @@ -21,5 +21,5 @@ app.use("/api/reports", require("./routes/reports")); app.use("/uploads", express.static("uploads")); // 📌 กำหนด PORT -const PORT = 5000; +const PORT = 8080; app.listen(PORT, () => console.log(`🚀 Server running on port ${PORT}`)); -- GitLab