params [ TIL ] [ node.js ]
Problem req.params 가 빈 객체가 전달된다. // index.js const express = require("express"); const commentRouter = require("./comments"); const postRouter = require("./posts"); const router = express.Router(); router.use("/posts", postRouter); router.use("/posts/:_postId", commentRouter) module.exports = router; // comments.js router.post("/comments", async (req, res) => { try { const postId = req.params; ..
2023.06.24