Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit fbd0782b authored by 65160024's avatar 65160024
Browse files

update server.js

parent a8c21ef4
No related branches found
No related tags found
No related merge requests found
...@@ -21,11 +21,7 @@ const db = mysql.createConnection({ ...@@ -21,11 +21,7 @@ const db = mysql.createConnection({
db.connect((err) => { db.connect((err) => {
if (err) { if (err) {
console.error("❌ ไม่สามารถเชื่อมต่อฐานข้อมูล:", err); console.error("❌ ไม่สามารถเชื่อมต่อฐานข้อมูล:", err);
<<<<<<< HEAD:server.js
return; return;
=======
process.exit(1); // ปิดโปรแกรมถ้าเชื่อมต่อไม่ได้
>>>>>>> 8a73597 (update server.js):server/server.js
} }
console.log("✅ เชื่อมต่อฐานข้อมูลสำเร็จ!"); console.log("✅ เชื่อมต่อฐานข้อมูลสำเร็จ!");
}); });
...@@ -42,19 +38,8 @@ readdirSync(routesPath).map((file) => { ...@@ -42,19 +38,8 @@ readdirSync(routesPath).map((file) => {
app.use("/api", require(routePath)); app.use("/api", require(routePath));
}); });
<<<<<<< HEAD:server.js
// app.get('/', (req, res) => { // app.get('/', (req, res) => {
// res.send('Hello World!') // res.send('Hello World!')
// }) // })
app.listen(3000, () => console.log("Server is running on port 3000")); app.listen(3000, () => console.log("Server is running on port 3000"));
=======
// Route หลัก
app.get("/", (req, res) => {
res.send("Hello, world!");
});
// เริ่มเซิร์ฟเวอร์
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`🚀 Server is running on port ${PORT}`));
>>>>>>> 8a73597 (update server.js):server/server.js
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment