當我們的網站變大,有很多router的時候,就不能用寫死的路徑(path)了吧,這個時候就需要用到dynamic router;

如何讓route的路徑可以根據實際情況進行改變呢?

//you can decide the id randomly
app.get(/profile/:id, function(req, res){
res.send(you request to see a profile with the id of + req.params.id)
});

圖1

推薦閱讀:

查看原文 >>
相關文章