yedra 0.9.2 → 0.9.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 +16 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# yedra
|
|
2
2
|
|
|
3
3
|
## Table Of Contents
|
|
4
4
|
|
|
@@ -14,61 +14,22 @@
|
|
|
14
14
|
|
|
15
15
|
## Introduction
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
similar to Zod, and a simple route system similar to express.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Instead, it makes it easy to build well-documented software: y supports
|
|
23
|
-
automatic generation of OpenAPI documentation for all endpoints. This includes
|
|
24
|
-
generating JSON schemas for all request and response bodies that are specified
|
|
25
|
-
using y schemas.
|
|
17
|
+
yedra is a web framework for TypeScript. It includes a validation library
|
|
18
|
+
similar to Zod, and a simple route system similar to express. yedra's primary
|
|
19
|
+
goal is to make it easy to build well-documented software: it supports automatic
|
|
20
|
+
generation of OpenAPI documentation for all endpoints, and generating JSON
|
|
21
|
+
schemas for all request and response bodies that are specified using schemas.
|
|
26
22
|
|
|
27
23
|
## Getting Started
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
To create a yedra project, run:
|
|
30
26
|
|
|
31
27
|
```bash
|
|
32
|
-
|
|
33
|
-
yarn
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then, create your first endpoint in `src/routes/up.ts`:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { y } from "@wemakefuture/y";
|
|
41
|
-
|
|
42
|
-
export default y.endpoint("/up", {
|
|
43
|
-
summary: "Get server status.",
|
|
44
|
-
method: "GET",
|
|
45
|
-
query: y.object({}),
|
|
46
|
-
headers: y.object({}),
|
|
47
|
-
req: y.object({}),
|
|
48
|
-
res: y.object({ message: y.string() }),
|
|
49
|
-
do(req) {
|
|
50
|
-
return {
|
|
51
|
-
body: {
|
|
52
|
-
message: "Healthy.",
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
And add this to `src/index.ts`:
|
|
60
|
-
|
|
61
|
-
```ts
|
|
62
|
-
import { y } from "@wemakefuture/y";
|
|
63
|
-
|
|
64
|
-
y.app(`${__dirname}/routes`).then((app) => {
|
|
65
|
-
app.listen(3000);
|
|
66
|
-
});
|
|
28
|
+
bun create yedra@latest my-project
|
|
29
|
+
yarn create yedra@latest my-project
|
|
30
|
+
npm create yedra@latest my-project
|
|
67
31
|
```
|
|
68
32
|
|
|
69
|
-
This starts a server with all endpoints in `src/routes` and listens on
|
|
70
|
-
port 3000.
|
|
71
|
-
|
|
72
33
|
## Endpoints
|
|
73
34
|
|
|
74
35
|
The core construct of y is the `endpoint`. Endpoints are created like this:
|
|
@@ -292,7 +253,8 @@ y generally tries to follow a semantic versioning model. Right now, y is
|
|
|
292
253
|
pre-1.0, so breaking changes can occur on every minor release.
|
|
293
254
|
|
|
294
255
|
- 0.8.0 - Removed `identity` encoding, changed error field to `errorMessage`
|
|
295
|
-
- 0.7.3 - Changed `accept-encoding` for `y.Http` to `identity` to prevent memory
|
|
256
|
+
- 0.7.3 - Changed `accept-encoding` for `y.Http` to `identity` to prevent memory
|
|
257
|
+
leak
|
|
296
258
|
- 0.7.2 - Added time and connection count to connection log
|
|
297
259
|
- 0.7.1 - Made headers on test service methods optional
|
|
298
260
|
- 0.7.0 - Added test service and env parser
|
|
@@ -324,3 +286,7 @@ pre-1.0, so breaking changes can occur on every minor release.
|
|
|
324
286
|
- 0.1.2 - Fixed y.number() minimum and maximum checks
|
|
325
287
|
- 0.1.1 - Added test cases, documentation and license
|
|
326
288
|
- 0.1.0 - Initial release
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```
|