This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
nitro.ts
69 lines (65 loc) · 1.84 KB
/
nitro.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { defineUntypedSchema } from 'untyped'
export default defineUntypedSchema({
/**
* Configuration for Nitro.
*
* @see https://nitro.unjs.io/config/
*
* @type {typeof import('nitropack')['NitroConfig']}
* @version 2
* @version 3
*/
nitro: {
routes: {
$resolve: async (val, get) => ({
...await get('routes') || {},
...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
*/
routes: {},
/**
* Nitro server handlers.
*
* Each handler accepts the following options:
* - handler: The path to the file defining the handler.
* - route: The route under which the handler is available. This follows the conventions of https://github.com/unjs/radix3.
* - 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.
*
* @see https://v3.nuxtjs.org/guide/features/server-routes
*
* @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' }
* ]
* ```
*
* @type {typeof import('nitropack')['NitroEventHandler'][]}
* @version 3
*/
serverHandlers: [],
/**
* Nitro development-only server handlers.
*
* @see https://nitro.unjs.io/guide/introduction/routing
*
* @type {typeof import('nitropack')['NitroDevEventHandler'][]}
* @version 3
*/
devServerHandlers: []
})