route.ts in the /apps/web/app/api is an API Route.
Here’s an example of an API Route that perform a Hello World:
Protected API Route
To create a protected api route, you need to decorate the example above with thewithSession helper:
Project-based Protected API Route
To create an api route that refers to a given project and not the authenticated user, use thewithAuth helper:
Role Protection
withAuth accepts a second optional argument with the following structure: