@@ -22,7 +22,7 @@ export const options = {
22
22
},
23
23
};
24
24
25
- export const handler: Handler = async (request , reply ) => {}
25
+ export const handler: Handler = async (request , reply ) => {};
26
26
```
27
27
28
28
More options are available
@@ -63,8 +63,8 @@ Running `npx fastify-schema-to-typescript` will convert `schema.yaml` to `schema
63
63
app.ts
64
64
65
65
```ts
66
- import fastify from ' fastify' ;
67
- import { healthcheck } from ' ./api'
66
+ import fastify from " fastify" ;
67
+ import { healthcheck } from " ./api";
68
68
69
69
export async function run() {
70
70
const app = fastify();
@@ -79,41 +79,37 @@ run();
79
79
api/index.ts
80
80
81
81
``` ts
82
- export * from ' ./healthcheck' ;
82
+ export * from " ./healthcheck" ;
83
83
```
84
84
85
85
api/healtheck/schema.yaml
86
86
87
87
``` yml
88
88
headers :
89
89
type : object
90
- properties :
91
- ...
90
+ properties : ...
92
91
93
92
body :
94
93
type : object
95
- properties :
96
- ...
94
+ properties : ...
97
95
98
96
query :
99
97
type : object
100
- properties :
101
- ...
98
+ properties : ...
102
99
103
100
params :
104
101
type : object
105
- properties :
106
- ...
102
+ properties : ...
107
103
` ` `
108
104
109
105
api/healtheck/index.ts
110
106
111
107
` ` ` ts
112
- import { FastifyPluginAsync } from ' fastify' ;
113
- import { RouteGeneric, schema } from ' ./schema' ;
108
+ import { FastifyPluginAsync } from " fastify" ;
109
+ import { RouteGeneric, schema } from " ./schema" ;
114
110
115
111
export const getHealthcheck : FastifyPluginAsync = async (app) => {
116
- app.get<RouteGeneric>(' /healthcheck' , { schema }, async () => {
112
+ app.get<RouteGeneric>(" /healthcheck" , { schema }, async () => {
117
113
return { ok : true };
118
114
});
119
115
};
0 commit comments