Handling Form Submission

Learn how to handle form submission in Express by creating a login form template and processing POST requests.

Let’s now take a look at how Express can interpret data that is submitted from a form on a web page. To do this, we will create a login.hbs template file and modify our login.ts route handler to accept a POST request, along with the existing GET request.

Creating the login template

We can create a file in the views directory named login.hbs as follows:

Get hands-on with 1400+ tech skills courses.