How to get data passed from a form in Express (Node.js)

前端 未结 3 1672
挽巷
挽巷 2020-12-04 20:59

I would like to get data that are passed from a page using a form and use that data in the page that is redirected.

I have this form in my client side:



        
3条回答
  •  日久生厌
    2020-12-04 21:46

    If you need to access variable names in your views, you should use the res.render function and pass the variable like:

    res.render('game', {
        name: req.body.name
    }
    

    and then in jade do

    div!= name
    

提交回复
热议问题