Grokking ExpressJS
0% completed
Handling Form Data
What does req.body contain when a browser submits the "New task" form below? The answer depends on two things: how the browser encoded the data, and which parser the server registered for that encoding. Without the right parser, req.body is undefined in Express 5, and the handler crashes when it reads a field.
<form id="taskForm" action="/tasks/form" method="POST"> <label for="title">Title</label> <input type="text" name="title" id="title" required /> <label for="priority">Priority</label> <select name="priority" id="priority"> <option value="low">Low</option>
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%