Enhancing the password login
Imagine the following scenario with JavaScript disabled in your browser: you open the ticket application login page, enter your credentials, and submit the form. What would happen? It would submit the form to the page itself because if no action
attribute is set in a <form>
element, it defaults to action=""
, which is the current page. With the submission, it would append your login credentials to the URL (host?email=...&password=...
), as the default submission method of a form is GET
. Other than that, nothing at all would happen as we don’t have anything that handles form data on the server.
Instead, we want to create a Route Handler to process such a submission on the backend. So, let’s create a Route Handler for a server-based password login process: app/auth/pw-login/route.js
.
Note
Although a page in Next.js is rendered on the server and can fetch on the backend, it is not architecturally built for processing...