We can use the 'body-parser' module to extract inputs from forms. These will be added to the body field of the request, when we call body-parser's urlencoded() method, which we can then use to submit a POST request.
Link to challenge : https://www.freecodecamp.org/learn/ap...
Written Guide : https://www.notion.so/ganeshh123/Use-...
Full Playlist for this course : • Basic Node and Express - freeCodeCamp
All Writen Guides for this course : https://www.notion.so/ganeshh123/dab5...
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganes...
Concepts:
bodyParser.urlencoded()
Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings. A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body). This object will contain key-value pairs, where the value can be a string or array (when extended is false), or any type (when extended is true).
https://github.com/expressjs/body-par...
request.body
Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware such as express.json() or express.urlencoded().
https://expressjs.com/en/api.html#req...
app.use()
Mounts the specified middleware function or functions at the specified path: the middleware function is executed when the base of the requested path matches path.
https://expressjs.com/en/api.html#app...
————————————————————————————————————
Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.
Express.js, or simply Express, is a web application framework for Node.js. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js. Express runs between the server created by Node.js and the frontend pages of a web application. Express also handles an application's routing.
freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.
Thanks for Watching!
Watch video 11 - Use body-parser to Parse POST Requests - Basic Node and Express - freeCodeCamp Tutorial online without registration, duration hours minute second in high quality. This video was added by user Ganesh H 07 July 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 11,730 once and liked it 133 people.