@dotpress/adapter-express 2.0.0-alpha.2 → 2.0.0-alpha.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.
Files changed (2) hide show
  1. package/README.md +5 -25
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > 🚧 Dotpress V2 is in alpha (`2.0.0-alpha`): the API may still change before 2.0.0.
6
6
 
7
7
  ```sh
8
- pnpm add @dotpress/core @dotpress/adapter-express express zod
8
+ npm install @dotpress/core @dotpress/adapter-express express zod
9
9
  ```
10
10
 
11
11
  ```ts
@@ -27,31 +27,11 @@ const app = await createApp({
27
27
  await app.listen(3000)
28
28
  ```
29
29
 
30
- ## Options
30
+ ## Documentation
31
31
 
32
- | Option | Description |
33
- | --- | --- |
34
- | `app` | Existing Express application (Express 4 or 5). Defaults to a new `express()` application, with `X-Powered-By` and `ETag` disabled. |
35
- | `beforeRoutes(app)` | Registers native middlewares before the Dotpress routes. |
36
- | `afterRoutes(app)` | Registers native middlewares and routes after the Dotpress routes, before the not-found handler. |
37
- | `bodyLimit` | Maximum request body size in bytes. Defaults to 1 MiB. |
38
-
39
- ## Behavior
40
-
41
- - Routes are matched by Dotpress, so they behave the same on every adapter (case-sensitive, static segments before parameters, Express settings such as `case sensitive routing` do not apply).
42
- - Request bodies are read by the adapter: JSON, URL-encoded forms and text are parsed, other content types are exposed as `Uint8Array`. Bodies already parsed by a native middleware (`express.json()`, `multer`…) are used as is.
43
- - Routes declared with `rawBody: true` need the adapter to read the body: do not register a native body parser for them.
44
- - Errors passed to `next(error)` by native middlewares use the Dotpress error format. Client errors (`status` 4xx) keep their status.
45
- - `ctx.raw` is the Express request.
46
- - `close()` waits for pending requests and closes the responses being streamed (Server-Sent Events).
47
- - `adapter.server()` returns the Node.js HTTP server started by `listen()`.
48
-
49
- To use your own HTTP server, mount the Express application yourself:
50
-
51
- ```ts
52
- const app = await createApp({ adapter: expressAdapter() })
53
- https.createServer(tlsOptions, app.native()).listen(443)
54
- ```
32
+ - [The Express adapter](https://dotpress.dev/adapters/express): options, behavior, native middlewares, your own server
33
+ - [Choosing an adapter](https://dotpress.dev/adapters/)
34
+ - [Node.js and containers](https://dotpress.dev/deployment/node)
55
35
 
56
36
  ## License
57
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpress/adapter-express",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Express 4 and 5 adapter for Dotpress",
5
5
  "author": "Renaud Guyon",
6
6
  "license": "MIT",
@@ -30,12 +30,12 @@
30
30
  "node": ">=22.12"
31
31
  },
32
32
  "peerDependencies": {
33
- "@dotpress/core": "^2.0.0-alpha.2",
33
+ "@dotpress/core": "^2.0.0-alpha.4",
34
34
  "express": "^4.21.0 || ^5.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@dotpress/core": "2.0.0-alpha.2",
38
- "@dotpress/testing": "2.0.0-alpha.2",
37
+ "@dotpress/core": "2.0.0-alpha.4",
38
+ "@dotpress/testing": "2.0.0-alpha.4",
39
39
  "@types/express": "^5.0.6",
40
40
  "express": "^5.3.0",
41
41
  "express-4": "npm:express@^4.22.3",