Currently delving into Next.js 13, I've implemented a form within my application for submitting a username and password to the server. The form's action path is designated as /submit with a POST request method. Yet, I'm encountering difficulty in deciphering how to receive and process the URL-encoded form data on the server-side.
Below showcases a simplified iteration of my form:
<form action="/submit" method="post">
<label htmlFor="username">Username:</label>
<input type="text" id="username" name="username" />
<label htmlFor="password">Password:</label>
<input type="password" id="password" name="password" />
<button type="submit">Submit</button>
</form>
In context of my Next.js application, what steps can be taken to access and manage the data submitted via this form? Specifically, the aim is to retrieve details from the username and password fields.
Explorations have led me to consider utilizing req.body within my Middleware function by importing NextRequest, but observations indicate that it isn't automatically populated with the form data. Are there any specific configurations needed to handle URL-encoded form data effectively in the realm of Next.js 13?
Your assistance or direction on this matter would be truly valued! Thank you in advance.