Getting the url parameters in an ejs template

前端 未结 3 1165
孤独总比滥情好
孤独总比滥情好 2021-02-05 19:15

I am trying to create an ejs conditional based on a URL parameter, for example, if the test parameter exists at localhost:3000/page?test, then show a div, else dont show it.

3条回答
  •  野的像风
    2021-02-05 19:30

    <%= req.query.paramName %>
    

    Works for me where paramName is the name of your URL query parameter.

提交回复
热议问题