18.
How can you define a custom API route in Next.js?
Import the API module from Next.js and use its route method
Define a route in the server.js file
Use the getServerSideProps function in a regular page component
Create a new file in the pages/api directory
Correct: D
To define a custom API route in Next.js, you need to create a new file in the "pages/api" directory. The filename will be the endpoint of the API route. Inside this file, you can write your API logic and handle incoming requests. This approach allows you to handle backend operations and create RESTful API endpoints easily within your Next.js application.