You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can register middleware for specific route patterns using the [`handlers`](#handlers-config) config with the `middleware` option and a specific `route`:
403
403
404
404
```ts [nitro.config.ts]
405
-
import { defineNitroConfig } from"nitro/config";
405
+
import { defineConfig } from"nitro";
406
406
407
-
exportdefaultdefineNitroConfig({
407
+
exportdefaultdefineConfig({
408
408
handlers: [
409
409
{
410
410
route: "/api/**",
@@ -437,7 +437,7 @@ Nitro allows you to add logic at the top-level for each route of your configurat
437
437
438
438
It is a map from route pattern (following [rou3](https://github.com/h3js/rou3)) to route options.
439
439
440
-
When `cache` option is set, handlers matching pattern will be automatically wrapped with `defineCachedEventHandler`. See the [cache guide](/docs/cache) to learn more about this function.
440
+
When `cache` option is set, handlers matching pattern will be automatically wrapped with `defineCachedHandler`. See the [cache guide](/docs/cache) to learn more about this function.
441
441
442
442
::note
443
443
`swr: true|number` is shortcut for `cache: { swr: true, maxAge: number }`
@@ -448,7 +448,7 @@ You can set route rules in the `nitro.routeRules` options.
448
448
```ts [nitro.config.ts]
449
449
import { defineConfig } from"nitro";
450
450
451
-
exportdefaultdefineNitroConfig({
451
+
exportdefaultdefineConfig({
452
452
routeRules: {
453
453
'/blog/**': { swr: true },
454
454
'/blog2/**': { swr: 600 },
@@ -472,9 +472,9 @@ Route rules are matched from least specific to most specific. When multiple rule
472
472
You can use `false` to disable a rule that was set by a more general pattern:
0 commit comments