Node.js - How to send data from html to express

前端 未结 2 1150
小蘑菇
小蘑菇 2020-11-29 16:32

this is form example in html:





CSS3 Contact Form
&         


        
2条回答
  •  一整个雨季
    2020-11-29 16:46

    I'd like to expand on Obertklep's answer. In his example it is an NPM module called body-parser which is doing most of the work. Where he puts req.body.name, I believe he/she is using body-parser to get the contents of the name attribute(s) received when the form is submitted.

    If you do not want to use Express, use querystring which is a built-in Node module. See the answers in the link below for an example of how to use querystring.

    It might help to look at this answer, which is very similar to your quest.

提交回复
热议问题