Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 3fa0b7ab authored by 65160394's avatar 65160394
Browse files

commit 1

parent ce8ba94c
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,11 @@ app.use(express.static("public"));
// ดึงรายการทัวร์
app.get("/", (req, res) => {
pool.query("SELECT * FROM tours", (err, results) => {
if (err) throw err;
res.render("index", { tours: results });
});
// pool.query("SELECT * FROM tours", (err, results) => {
// if (err) throw err;
res.render("index");
});
// });
// เพิ่มทัวร์ใหม่
app.post("/add", (req, res) => {
......
......@@ -7,11 +7,7 @@
</head>
<body>
<h1>รายการทัวร์</h1>
<ul>
<% tours.forEach(tour => { %>
<li><%= tour.name %> - <%= tour.location %> - $<%= tour.price %></li>
<% }) %>
</ul>
<h2>เพิ่มทัวร์ใหม่</h2>
<form action="/add" method="POST">
<input type="text" name="name" placeholder="ชื่อทัวร์" required>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment