Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix incorrect Controller and parameter decorators #34

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions docs/overview/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,30 @@ HTTP methods and parameters decorators are a set of annotations used in Expresso

Here's a list of all available `@httpMethods()` decorators in ExpressoTS, along with their description and usage:

| Decorator | Description | Usage |
| ----------- | -------------------------------------------------- | ---------------------------- |
| @httpGet | Binds a controller method to a GET HTTP verb. | @httpGet("/path") |
| @httpPost | Binds a controller method to a POST HTTP verb. | @httpPost("/path") |
| @httpPut | Binds a controller method to a PUT HTTP verb. | @httpPut("/path") |
| @httpPatch | Binds a controller method to a PATCH HTTP verb. | @httpPatch("/path") |
| @httpHead | Binds a controller method to a HEAD HTTP verb. | @httpHead("/path") |
| @httpDelete | Binds a controller method to a DELETE HTTP verb. | @httpDelete("/path") |
| @httpMethod | Binds a controller method to a specified HTTP verb.| @httpMethod("verb", "/path") |
| Decorator | Description | Usage |
| --------- | --------------------------------------------------- | ------------------------ |
| @Get | Binds a controller method to a GET HTTP verb. | @Get("/path") |
| @Post | Binds a controller method to a POST HTTP verb. | @Post("/path") |
| @Put | Binds a controller method to a PUT HTTP verb. | @Put("/path") |
| @Patch | Binds a controller method to a PATCH HTTP verb. | @Patch("/path") |
| @Head | Binds a controller method to a HEAD HTTP verb. | @Head("/path") |
| @Delete | Binds a controller method to a DELETE HTTP verb. | @Delete("/path") |
| @Method | Binds a controller method to a specified HTTP verb. | @Method("verb", "/path") |

### Parameter Decorators

Here's a list of all available parameter decorators in ExpressoTS, along with their description and usage:

| Decorator | Description | Usage
| ------------------------------------ | ------------------------------------------------------ | -------------------------------------------------------- |
| @request() | Injects the Express Request object. | execute(@request() req: Request)
| @response() | Injects the Express Response object. | execute(@response() res: Response)
| @requestParam(paramName?: string) | Injects a parameter from the request URL path. | execute(@requestParam('id') id: string)
| @queryParam(paramName?: string) | Injects a parameter from the request URL query string. | execute(@queryParam('searchTerm') searchTerm: string)
| @requestBody() | Injects the request body payload. | execute(@requestBody() body: MyDTO)
| @requestHeaders(headerName?: string) | Injects a header from the request headers. | execute(@requestHeaders('authorization') auth: string)
| @cookies(cookieName?: string) | Injects a cookie from the request cookies. | execute(@cookies('session') session: string)
| @next() | Injects the Express NextFunction object. | execute(@next() next: NextFunction)
| Decorator | Description | Usage |
| ----------------------------- | ------------------------------------------------------ | ------------------------------------------------ |
| @request() | Injects the Express Request object. | execute(@request() req: Request) |
| @response() | Injects the Express Response object. | execute(@response() res: Response) |
| @param(paramName?: string) | Injects a parameter from the request URL path. | execute(@param('id') id: string) |
| @query(paramName?: string) | Injects a parameter from the request URL query string. | execute(@query('searchTerm') searchTerm: string) |
| @body() | Injects the request body payload. | execute(@body() body: MyDTO) |
| @headers(headerName?: string) | Injects a header from the request headers. | execute(@headers('authorization') auth: string) |
| @cookies(cookieName?: string) | Injects a cookie from the request cookies. | execute(@cookies('session') session: string) |
| @next() | Injects the Express NextFunction object. | execute(@next() next: NextFunction) |

## An MVC Approach

Expand Down