@sleekify/sleekify-fastify 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,21 @@ Your API documentation will both match the OpenAPI specification's schema and be
|
|
|
24
24
|
2. Create REST resources using the provided decorators
|
|
25
25
|
<br/><sub>_src/v1/users.ts_</sub>
|
|
26
26
|
```TypeScript
|
|
27
|
+
import { type FastifyReply, type FastifyRequest } from 'fastify';
|
|
28
|
+
|
|
29
|
+
@Path('/v1/users')
|
|
30
|
+
export class UsersResource {
|
|
31
|
+
@POST()
|
|
32
|
+
async createOne (request: FastifyRequest, reply: FastifyReply) {
|
|
33
|
+
// TODO: your create user code here
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@GET()
|
|
37
|
+
async getMany (request: FastifyRequest, reply: FastifyReply) {
|
|
38
|
+
// TODO: your query users code here
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
@Path({
|
|
28
43
|
path: '/v1/users/{id}',
|
|
29
44
|
parameters: [
|
|
@@ -37,17 +52,17 @@ Your API documentation will both match the OpenAPI specification's schema and be
|
|
|
37
52
|
})
|
|
38
53
|
export class UsersIdResource {
|
|
39
54
|
@GET()
|
|
40
|
-
async getOne () {
|
|
55
|
+
async getOne (request: FastifyRequest, reply: FastifyReply) {
|
|
41
56
|
// TODO: your read user code here
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
@PUT()
|
|
45
|
-
async updateOne () {
|
|
60
|
+
async updateOne (request: FastifyRequest, reply: FastifyReply) {
|
|
46
61
|
// TODO: your update user code here
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
@DELETE()
|
|
50
|
-
async deleteOne () {
|
|
65
|
+
async deleteOne (request: FastifyRequest, reply: FastifyReply) {
|
|
51
66
|
// TODO: your delete user code here
|
|
52
67
|
}
|
|
53
68
|
}
|