#Exports

1 messages · Page 1 of 1 (latest)

digital ridgeBOT
#

Hi @cursive atlas. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

It seems like you're encountering an error because your route.js file doesn't have any HTTP methods exported. In Next.js, a route.js file is used to create custom request handlers for a given route. You need to export a function for each HTTP method you want to handle. The supported HTTP methods are GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.

Here's an example of how you can define these methods in your route.js file:

export async function GET(request: Request) {}

export async function HEAD(request: Request) {}

export async function POST(request: Request) {}

export async function PUT(request: Request) {}

export async function DELETE(request: Request) {}

export async function PATCH(request: Request) {}

// If `OPTIONS` is not defined, Next.js will automatically implement `OPTIONS` and set the appropriate Response `Allow` header depending on the other methods defined in the route handler.
export async function OPTIONS(request: Request) {}

Remember, Route Handlers are only available inside the app directory. You do not need to use API Routes (pages) and Route Handlers (app) together, as Route Handlers should be able to handle all use cases.

For more information, you can refer to the Next.js documentation on route files (https://nextjs.org/docs/app/api-reference/file-conventions/route).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: