I had this idea to change the handler of a rest request in express on the fly without restarting the server. My idea was something like that
app.use("/test", (req,res) => {
res.json("hello!");
})
app.use("/test", (req,res) => {
res.json("bye!");
})
But it doesn't seem to work, because I always get the answer back from the first one. I think express just appends the second one to the same route, but how can I replace them.
答案 0 :(得分:0)
简单的方法是在处理程序周围构建一个包装器。
GetRenderingHtml