1.0.19 • Published 11 months ago
@fastify-dev-toolkit/server v1.0.19
fastify plugin with auto json schema with type definitions
install
npm install @fastify-dev-toolkit/compiler
npm install @fastify-dev-toolkit/serveradd this in tsconfig.json
/
└── src
├── routes // file route
└── schema // type def in this folder will auto build to json schemaexample
/
└── src
├── routes
│ └── api
│ └── v1
│ └── test.ts // url for /api/v1/test
└── schema
└── api
└── one.ts// /api/v1/test.ts
import {A, B} from '../schema/api/one'
export default class AAA {
get(): string {
return 'ok'
}
post(request?: IPost<{ Body: Omit<A, 'a'>, Querystring: B }>): string {
return 'ok'
}
put(): string {
return ''
}
delete(): string {
return ''
}
}// /schema/api/one.ts
type A = {
a: string
b: number
c: MultipartUploadField
}
type B = {
a: string
b: number
}if the ENVIRONMENT=development exist.
PORT=4002
use /documentation/ to view swagger
need ts-patch and add this in scripts
scripts: {
"prepare": "ts-patch install -s"
}1.0.19
11 months ago
1.0.18
11 months ago
1.0.17
11 months ago
1.0.16
11 months ago
1.0.15
11 months ago
1.0.14
11 months ago
1.0.13
11 months ago
1.0.12
11 months ago
1.0.11
11 months ago
1.0.10
11 months ago
1.0.9
11 months ago
1.0.8
11 months ago
1.0.7
11 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
12 months ago
1.0.3
12 months ago
1.0.2
1 year ago