Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
horvbalint committed Nov 18, 2024
1 parent 704995c commit ab7d449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/1.guide/2.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,14 @@ Returning anything from a middleware will close the request and should be avoide

### Route Meta

You can define route handler meta at build-time using `defineRouteMeta` micro in the event handler files.
You can define route handler meta at build-time using `defineRouteMeta` macro in the event handler files.

> [!IMPORTANT]
> 🚧 This feature is currently experimental.
```ts [/api/test.ts]
defineRouteMeta({
openAPIEnabled: false, // defaults to true
openAPI: {
tags: ["test"],
description: "Test route description",
Expand Down Expand Up @@ -298,6 +299,7 @@ export default defineNitroConfig({
'/blog/**': { cache: { /* cache options*/ } },
'/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
'/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
'/api/v1/admin/**': { openAPIEnabled: false },
'/old-page': { redirect: '/new-page' },
'/old-page/**': { redirect: '/new-page/**' },
'/proxy/example': { proxy: 'https://example.com' },
Expand All @@ -314,6 +316,7 @@ export default defineNuxtConfig({
'/blog/**': { cache: { /* cache options*/ } },
'/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
'/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
'/api/v1/admin/**': { openAPIEnabled: false },
'/old-page': { redirect: '/new-page' },
'/old-page/**': { redirect: '/new-page/**' },
'/proxy/example': { proxy: 'https://example.com' },
Expand Down
1 change: 1 addition & 0 deletions docs/3.config/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ routeRules: {
'/blog/**': { cache: { /* cache options*/ } },
'/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
'/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
'/api/v1/admin/**': { openAPIEnabled: false },
'/old-page': { redirect: '/new-page' }, // uses status code 307 (Temporary Redirect)
'/old-page2': { redirect: { to:'/new-page2', statusCode: 301 } },
'/old-page/**': { redirect: '/new-page/**' },
Expand Down

0 comments on commit ab7d449

Please sign in to comment.