minimonolith 0.22.2 → 0.22.4
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 +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Here's an example project using `minimonolith`:
|
|
|
27
27
|
|
|
28
28
|
### server.js
|
|
29
29
|
|
|
30
|
-
This file is used for local development. It runs a local server using `minimonolith`'s `
|
|
30
|
+
This file is used for local development. It runs a local server using `minimonolith`'s `getServer` function:
|
|
31
31
|
|
|
32
32
|
```js
|
|
33
33
|
// server.js
|
|
@@ -115,13 +115,13 @@ This file validates the `get:id` method's input, ensuring that the provided `id`
|
|
|
115
115
|
|
|
116
116
|
```js
|
|
117
117
|
// todo/get/valid.js
|
|
118
|
-
import { z,
|
|
118
|
+
import { z, zdb } from 'minimonolith';
|
|
119
119
|
|
|
120
120
|
export default ({ MODELS }) => ({
|
|
121
121
|
id: z.string()
|
|
122
|
-
.superRefine(
|
|
122
|
+
.superRefine(zdb.isSafeInt('id'))
|
|
123
123
|
.transform(id => parseInt(id))
|
|
124
|
-
.superRefine(
|
|
124
|
+
.superRefine(zdb.exists(MODELS.todo, 'id')),
|
|
125
125
|
})
|
|
126
126
|
```
|
|
127
127
|
|