Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
feat(schema): add experimental routesRules shortcut (#7954)
Browse files Browse the repository at this point in the history
* feat(schema): add `routes` as shortcut for `nitro.routes`

* docs: improve wording

* docs: update wording

* chore: match nitro version

* update jsdocs

* refactor: use `routeRules`

Co-authored-by: Pooya Parsa <pooya@pi0.io>
  • Loading branch information
danielroe and pi0 committed Oct 17, 2022
1 parent 2a4ebfb commit df2bad7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 128 deletions.
1 change: 1 addition & 0 deletions packages/schema/package.json
Expand Up @@ -18,6 +18,7 @@
"@types/semver": "^7",
"@vitejs/plugin-vue": "^3.1.2",
"@vueuse/head": "~1.0.0-rc.9",
"nitropack": "npm:nitropack-edge@0.6.0-27766621.5c2c313",
"unbuild": "latest",
"vite": "~3.1.8"
},
Expand Down
21 changes: 20 additions & 1 deletion packages/schema/src/config/nitro.ts
Expand Up @@ -10,7 +10,26 @@ export default defineUntypedSchema({
* @version 2
* @version 3
*/
nitro: {},
nitro: {
routes: {
$resolve: async (val, get) => ({
...await get('routeRules') || {},
...val || {}
})
}
},

/**
* Global route options applied to matching server routes.
*
* @experimental This is an experimental feature and API may change in the future.
*
* @see https://nitro.unjs.io/config/#routes
*
* @type {typeof import('nitropack')['NitroConfig']['routes']}
* @version 3
*/
routeRules: {},

/**
* Nitro server handlers.
Expand Down

0 comments on commit df2bad7

Please sign in to comment.