Skip to content

Commit

Permalink
docs(express): fix readme and jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyben committed May 25, 2022
1 parent 6deac71 commit c7c3aa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 6 additions & 12 deletions express/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ _Also possible with child routers._

##### Plain express routers

To be able to progressively switch to Reflet, you can still register your plain express routers, with the help of the previous `path` property:
To be able to progressively switch to Reflet, you can still register your plain express routers, with the help of the previous path tuple:

```ts
@Router('/decorated')
Expand Down Expand Up @@ -386,18 +386,12 @@ class ItemRouter {
}

@Router('/foo')
class FooRouter {
constructor() {
register(this, [['/items', ItemRouter]])
}
}
@Router.Children(() => [['/items', ItemRouter]])
class FooRouter {}

@Router('/bar')
class BarRouter {
constructor() {
register(this, [['/elements', ItemRouter]])
}
}
@Router.Children(() => [['/elements', ItemRouter]])
class BarRouter {}
```

### Handler parameters injection
Expand Down Expand Up @@ -1022,7 +1016,7 @@ Express default error handler always sends a `text/html` response ([source code]

* `sendAsJson: true` always sends the error with `res.json`.

* `sendAsJson: false` sends the error with `res.send` (default).
* `sendAsJson: false` passes the error to `next` to be handled by express final handler (default).

* `sendAsJson: 'from-response-type'` sends the error with `res.json` by looking for `Content-Type` on the response:

Expand Down
2 changes: 1 addition & 1 deletion express/src/param-decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export namespace Headers {
* // Advanced decorator (with option and middleware):
* const BodyTrimmed = (key: string) => createParamDecorator(
* (req) => req.body[key].trim(),
* [{ handler: express.json(), dedupeByReference: true, dedupeByName: true }]
* [{ handler: express.json(), dedupe: true }]
* )
* class Foo {
* @Post('/message')
Expand Down

0 comments on commit c7c3aa5

Please sign in to comment.