Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
A closer look at Express's Request object.
HTML Forms
-
Sending form data (MDN)
- HTML forms (MDN general form page)
Documentation
What body-parser
Does Under the Hood
What is body-parser doing? In case you're curious, here's a little code that reads the body of an incoming request and logs it to the console. This is just a flavor of how using body-parser is making your life easier!
let bodyString = ''
req.on('data', chunk => bodyString += chunk.toString());
req.on('end', () => {
console.log(bodyString);
});
Note that even after bodyString
has been read completely, it still needs to be turned from a string into data your application can use, all of which is taken care of by body-parser.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up