2022-08-26 15:47:29 +00:00
|
|
|
import { defineUntypedSchema } from 'untyped'
|
2024-05-09 17:49:35 +00:00
|
|
|
import type { RuntimeConfig } from '../types/config'
|
2022-08-26 15:47:29 +00:00
|
|
|
|
|
|
|
export default defineUntypedSchema({
|
2022-02-10 17:29:59 +00:00
|
|
|
/**
|
2022-08-11 21:25:35 +00:00
|
|
|
* Configuration for Nitro.
|
2024-08-05 17:10:23 +00:00
|
|
|
* @see [Nitro configuration docs](https://nitro.unjs.io/config/)
|
2022-04-07 12:57:57 +00:00
|
|
|
* @type {typeof import('nitropack')['NitroConfig']}
|
2022-08-11 21:25:35 +00:00
|
|
|
*/
|
2022-10-17 11:22:30 +00:00
|
|
|
nitro: {
|
2024-05-09 17:49:35 +00:00
|
|
|
runtimeConfig: {
|
|
|
|
$resolve: async (val: Record<string, any> | undefined, get) => {
|
|
|
|
const runtimeConfig = await get('runtimeConfig') as RuntimeConfig
|
|
|
|
return {
|
|
|
|
...runtimeConfig,
|
|
|
|
app: {
|
|
|
|
...runtimeConfig.app,
|
|
|
|
baseURL: runtimeConfig.app.baseURL.startsWith('./')
|
|
|
|
? runtimeConfig.app.baseURL.slice(1)
|
|
|
|
: runtimeConfig.app.baseURL,
|
|
|
|
},
|
|
|
|
nitro: {
|
|
|
|
envPrefix: 'NUXT_',
|
|
|
|
...runtimeConfig.nitro,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2022-10-17 14:10:46 +00:00
|
|
|
routeRules: {
|
2024-01-29 16:53:25 +00:00
|
|
|
$resolve: async (val: Record<string, any> | undefined, get) => ({
|
|
|
|
...await get('routeRules') as Record<string, any>,
|
2024-04-05 18:08:32 +00:00
|
|
|
...val,
|
|
|
|
}),
|
|
|
|
},
|
2022-10-17 11:22:30 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Global route options applied to matching server routes.
|
|
|
|
* @experimental This is an experimental feature and API may change in the future.
|
2024-08-05 17:10:23 +00:00
|
|
|
* @see [Nitro route rules documentation](https://nitro.unjs.io/config/#routerules)
|
2022-10-17 14:10:46 +00:00
|
|
|
* @type {typeof import('nitropack')['NitroConfig']['routeRules']}
|
2022-10-17 11:22:30 +00:00
|
|
|
*/
|
|
|
|
routeRules: {},
|
2022-05-06 13:31:52 +00:00
|
|
|
|
|
|
|
/**
|
2022-08-11 21:25:35 +00:00
|
|
|
* Nitro server handlers.
|
2022-05-06 13:31:52 +00:00
|
|
|
*
|
2022-09-05 07:33:07 +00:00
|
|
|
* Each handler accepts the following options:
|
2024-05-27 11:09:12 +00:00
|
|
|
*
|
2022-09-05 07:33:07 +00:00
|
|
|
* - handler: The path to the file defining the handler.
|
2024-08-28 12:28:14 +00:00
|
|
|
* - route: The route under which the handler is available. This follows the conventions of [rou3](https://github.com/unjs/rou3.)
|
2022-09-05 07:33:07 +00:00
|
|
|
* - method: The HTTP method of requests that should be handled.
|
|
|
|
* - middleware: Specifies whether it is a middleware handler.
|
|
|
|
* - lazy: Specifies whether to use lazy loading to import the handler.
|
2024-05-27 11:09:12 +00:00
|
|
|
*
|
2024-08-05 17:10:23 +00:00
|
|
|
* @see [`server/` directory documentation](https://nuxt.com/docs/guide/directory-structure/server)
|
2022-09-05 07:33:07 +00:00
|
|
|
* @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt.
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* serverHandlers: [
|
|
|
|
* { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' }
|
|
|
|
* ]
|
|
|
|
* ```
|
2022-05-06 13:31:52 +00:00
|
|
|
* @type {typeof import('nitropack')['NitroEventHandler'][]}
|
|
|
|
*/
|
|
|
|
serverHandlers: [],
|
|
|
|
|
|
|
|
/**
|
2022-08-11 21:25:35 +00:00
|
|
|
* Nitro development-only server handlers.
|
2024-08-05 17:10:23 +00:00
|
|
|
* @see [Nitro server routes documentation](https://nitro.unjs.io/guide/routing)
|
2022-05-06 13:31:52 +00:00
|
|
|
* @type {typeof import('nitropack')['NitroDevEventHandler'][]}
|
|
|
|
*/
|
2024-04-05 18:08:32 +00:00
|
|
|
devServerHandlers: [],
|
2022-08-26 15:47:29 +00:00
|
|
|
})
|