express-zod-api 5.0.0-beta1 → 5.0.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/CHANGELOG.md +11 -2
- package/README.md +34 -3
- package/SECURITY.md +2 -1
- package/dist/startup-logo.js +1 -1
- package/dist-esm/package.json +1 -1
- package/dist-esm/startup-logo.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Version 5
|
|
4
4
|
|
|
5
|
+
### v5.0.0
|
|
6
|
+
|
|
7
|
+
- No changes.
|
|
8
|
+
|
|
5
9
|
### v5.0.0-beta1
|
|
6
10
|
|
|
7
11
|
- The ability to configure and run an additional HTTPS server to process requests over a secure protocol.
|
|
8
12
|
- This option is only available when using `createServer()` method.
|
|
9
13
|
- **Breaking changes**: Instead of HTTP Server the method `createServer()` now returns an object with the following
|
|
10
|
-
entities: app, httpServer, httpsServer, logger
|
|
14
|
+
entities: `app, httpServer, httpsServer, logger`.
|
|
11
15
|
- New configuration option `https`:
|
|
12
16
|
|
|
13
17
|
```typescript
|
|
@@ -17,7 +21,6 @@ const config = createConfig({
|
|
|
17
21
|
server: {
|
|
18
22
|
listen: 80,
|
|
19
23
|
},
|
|
20
|
-
cors: true,
|
|
21
24
|
// enables HTTPS server as well
|
|
22
25
|
https: {
|
|
23
26
|
// at least "cert" and "key" options required
|
|
@@ -27,11 +30,17 @@ const config = createConfig({
|
|
|
27
30
|
},
|
|
28
31
|
listen: 443, // port or socket
|
|
29
32
|
},
|
|
33
|
+
// ...
|
|
30
34
|
});
|
|
31
35
|
```
|
|
32
36
|
|
|
33
37
|
## Version 4
|
|
34
38
|
|
|
39
|
+
### v4.2.0
|
|
40
|
+
|
|
41
|
+
- `express` version is 4.17.2.
|
|
42
|
+
- `http-errors` version is 2.0.0.
|
|
43
|
+
|
|
35
44
|
### v4.1.0
|
|
36
45
|
|
|
37
46
|
- Feature #230. The shorthand method `EndpointsFactory::addOptions()`.
|
package/README.md
CHANGED
|
@@ -38,14 +38,15 @@ Start your API server with I/O schema validation and custom middlewares in minut
|
|
|
38
38
|
10. [Usage with your own express app](#usage-with-your-own-express-app)
|
|
39
39
|
11. [Multiple schemas for one route](#multiple-schemas-for-one-route)
|
|
40
40
|
12. [Customizing input sources](#customizing-input-sources)
|
|
41
|
-
13. [
|
|
42
|
-
14. [
|
|
41
|
+
13. [Enabling HTTPS](#enabling-https)
|
|
42
|
+
14. [Exporting endpoint types to frontend](#exporting-endpoint-types-to-frontend)
|
|
43
|
+
15. [Creating a documentation](#creating-a-documentation)
|
|
43
44
|
5. [Known issues](#known-issues)
|
|
44
45
|
1. [Excessive properties in endpoint output](#excessive-properties-in-endpoint-output)
|
|
45
46
|
6. [Your input to my output](#your-input-to-my-output)
|
|
46
47
|
|
|
47
48
|
You can find the release notes in [Changelog](CHANGELOG.md). Along with recommendations for migrating from
|
|
48
|
-
[v3](CHANGELOG.md#v400), [v2](CHANGELOG.md#v300-beta1) and [v1](CHANGELOG.md#v200-beta1).
|
|
49
|
+
[v4](CHANGELOG.md#v500-beta1), [v3](CHANGELOG.md#v400), [v2](CHANGELOG.md#v300-beta1) and [v1](CHANGELOG.md#v200-beta1).
|
|
49
50
|
|
|
50
51
|
# Why and what is it for
|
|
51
52
|
|
|
@@ -573,6 +574,36 @@ createConfig({
|
|
|
573
574
|
});
|
|
574
575
|
```
|
|
575
576
|
|
|
577
|
+
## Enabling HTTPS
|
|
578
|
+
|
|
579
|
+
The modern API standard often assumes the use of a secure data transfer protocol, confirmed by a TLS certificate, also
|
|
580
|
+
often called an SSL certificate in habit. When using the `createServer()` method, you can additionally configure and
|
|
581
|
+
run the HTTPS server.
|
|
582
|
+
|
|
583
|
+
```typescript
|
|
584
|
+
import { createConfig, createServer } from "express-zod-api";
|
|
585
|
+
|
|
586
|
+
const config = createConfig({
|
|
587
|
+
server: {
|
|
588
|
+
listen: 80,
|
|
589
|
+
},
|
|
590
|
+
https: {
|
|
591
|
+
options: {
|
|
592
|
+
cert: fs.readFileSync("fullchain.pem", "utf-8"),
|
|
593
|
+
key: fs.readFileSync("privkey.pem", "utf-8"),
|
|
594
|
+
},
|
|
595
|
+
listen: 443, // port or socket
|
|
596
|
+
},
|
|
597
|
+
// ... cors, logger, etc
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
const { app, httpServer, httpsServer, logger } = createServer(config, routing);
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
At least you need to specify the port or socket (usually it is 443), certificate and the key, issued by the
|
|
604
|
+
certifying authority. For example, you can acquire a free TLS certificate for your API at
|
|
605
|
+
[Let's Encrypt](https://letsencrypt.org/).
|
|
606
|
+
|
|
576
607
|
## Exporting endpoint types to frontend
|
|
577
608
|
|
|
578
609
|
You can export only the types of your endpoints for your frontend. Here is an approach:
|
package/SECURITY.md
CHANGED
package/dist/startup-logo.js
CHANGED
|
@@ -17,7 +17,7 @@ const getStartupLogo = () => {
|
|
|
17
17
|
[95m8888888888 888 888 88888P" 888 "Y8888 88888P' 88888P' d8888888888 "Y88P" "Y88888 d88P 888 888 8888888[39m[94m[39m
|
|
18
18
|
[94m 888[39m
|
|
19
19
|
[94m 888[3m Proudly supports transgender community.[23m[39m
|
|
20
|
-
[94m[3mfor
|
|
20
|
+
[94m[3mfor Ella [23m 888[3m Start your API server with I/O schema validation and custom middlewares in minutes.[23m[39m[90m[39m
|
|
21
21
|
[90m[3m Thank you for choosing Express Zod API for your project.[23m[39m[0m[0m
|
|
22
22
|
[0m[0m
|
|
23
23
|
[0m[0m
|
package/dist-esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"5.0.0
|
|
1
|
+
{"type":"module","version":"5.0.0"}
|
package/dist-esm/startup-logo.js
CHANGED
|
@@ -14,7 +14,7 @@ export const getStartupLogo = () => {
|
|
|
14
14
|
[95m8888888888 888 888 88888P" 888 "Y8888 88888P' 88888P' d8888888888 "Y88P" "Y88888 d88P 888 888 8888888[39m[94m[39m
|
|
15
15
|
[94m 888[39m
|
|
16
16
|
[94m 888[3m Proudly supports transgender community.[23m[39m
|
|
17
|
-
[94m[3mfor
|
|
17
|
+
[94m[3mfor Ella [23m 888[3m Start your API server with I/O schema validation and custom middlewares in minutes.[23m[39m[90m[39m
|
|
18
18
|
[90m[3m Thank you for choosing Express Zod API for your project.[23m[39m[0m[0m
|
|
19
19
|
[0m[0m
|
|
20
20
|
[0m[0m
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-zod-api",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A Typescript library to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"import": "./dist-esm/index.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"express": "4.17.
|
|
37
|
+
"express": "4.17.2",
|
|
38
38
|
"express-fileupload": "1.2.1",
|
|
39
|
-
"http-errors": "
|
|
39
|
+
"http-errors": "2.0.0",
|
|
40
40
|
"mime": "3.0.0",
|
|
41
41
|
"openapi3-ts": "2.0.1",
|
|
42
42
|
"ramda": "0.27.1",
|