Skip to content

Commit

Permalink
docs: Clarify Vercel Api route mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
rieger-jared authored and Hebilicious committed Jul 4, 2023
1 parent 1950d1e commit e35046a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/content/1.guide/3.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Nitro supports file-based routing for your API routes.

Handler files inside `api/` and `routes/` directory will be automatically mapped to [unjs/h3](https://github.com/unjs/h3) routes.

::alert{type=primary}
Due to some providers like Vercel using top-level `api/` directory as a feature, Nitro also supports `routes/api/` to create API routes.
::

```md
api/
test.ts <-- /api/test
Expand All @@ -25,6 +21,13 @@ routes/
nitro.config.ts
```

::alert{type=primary}
Some providers like Vercel use a top-level `api/` directory as a feature. This
means that routes placed in `/api` wont work. Since Nitro also supports
`routes/api/` to create API routes, simple move your api folder to the
`routes/` folder.
::

::alert
If you are using [Nuxt](https://nuxt.com), move the `api/` and `routes/` inside the `server/` directory.
::
Expand Down

0 comments on commit e35046a

Please sign in to comment.