> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt
> - To build a Wix site agentically, follow https://www.wix.com/headless/skill.md

## Resource: src/api/

## Article: 

## Article Link: https://dev.wix.com/docs/wix-cli/cli-for-apps/project-structure/folders-and-files/src-api.md

## Article Content:

# src/api/

The `src/api/` folder contains your backend [HTTP endpoints](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/backend/http-endpoints/about-http-endpoints.md), where each `.ts` or `.js` file is auto-discovered as a route. The folder is named on `app()` as `apiDir`, in [extensions.ts](https://dev.wix.com/docs/wix-cli/cli-for-apps/project-structure/folders-and-files/extensions-ts.md).

In the following example, `extensions.ts` names the folder explicitly and registers one extension, `myPage`:

```ts
export default app({ apiDir: './api' })
  .use(myPage);
```

A route is the file's path relative to that folder, with no prefix added. So `src/api/orders.ts` is served at `/orders`, and `src/api/users/[id].ts` at `/users/:id`. A file named `index.ts` serves its parent folder's route.

`apiDir` defaults to `api`, so a project that keeps its endpoints in `src/api/` doesn't need to declare it. Only the folder in use is scanned, so an endpoint outside it isn't served.