Wildcard in Express/node.js router

后端 未结 2 1311
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-11 19:27

I would like to \"get rid\" of the router in node.js. Currently, what I have is something that looks like this:

app.get \'/thing1\', (req, res) ->
    re         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-11 20:32

    app.get('/:thing', function (req, res) {
      res.render(req.params.thing)
    })
    

提交回复
热议问题