@web-ts-toolkit/express-response-handler 0.29.0 → 0.31.0
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 +12 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -26,6 +26,14 @@ import { NotFoundError } from '@web-ts-toolkit/http-errors';
|
|
|
26
26
|
const { handleResponse, HttpResponse } = apiHandler;
|
|
27
27
|
const app = express();
|
|
28
28
|
|
|
29
|
+
async function getUser(id: string) {
|
|
30
|
+
return id === 'missing' ? null : { id, name: 'Ada' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function createJob() {
|
|
34
|
+
return { id: 'job_1' };
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
app.get(
|
|
30
38
|
'/health',
|
|
31
39
|
handleResponse(() => ({ ok: true })),
|
|
@@ -71,6 +79,10 @@ Subpath entrypoints:
|
|
|
71
79
|
```ts
|
|
72
80
|
import { Created, NoContent } from '@web-ts-toolkit/express-response-handler/responses/success';
|
|
73
81
|
|
|
82
|
+
async function createUser() {
|
|
83
|
+
return { id: 'user_1' };
|
|
84
|
+
}
|
|
85
|
+
|
|
74
86
|
app.post(
|
|
75
87
|
'/users',
|
|
76
88
|
handleResponse(async () => Created(await createUser())),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/express-response-handler",
|
|
3
3
|
"description": "FastAPI-style return-value response handling for Express",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/express-response-handler",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.31.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"keywords": [
|
|
8
8
|
"express",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@fast-csv/format": "^5.0.7",
|
|
54
|
-
"@web-ts-toolkit/http-errors": "0.
|
|
55
|
-
"@web-ts-toolkit/utils": "0.
|
|
54
|
+
"@web-ts-toolkit/http-errors": "0.31.0",
|
|
55
|
+
"@web-ts-toolkit/utils": "0.31.0"
|
|
56
56
|
},
|
|
57
57
|
"files": [
|
|
58
58
|
"**/*",
|