code
import express from "express";
// 서버 생성
const app = express();
// params
app.get("/params/:id", (req, res) => {
console.log("req.params: ", req.params);
console.log("req.params: ", req.params.id);
res.send("Params Test");
});
// query
app.get("/query", (req, res) => {
console.log("req.query: ", req.query);
console.log("req.query: ", req.query.id);
res.send("Query Test");
});
// 8000포트로 서버 열기
app.listen(8000);
http://localhost:8000/param/25
http://localhost:8000/query
http://localhost:8000/query?id=25