Skip to content

Commit 0427d3a

Browse files
authored
nest g controller cats -> nest g controller [name]
1 parent 65b5bce commit 0427d3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/controllers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class CatsController {
3737
}
3838
```
3939

40-
> info **Hint** To create a controller using the CLI, simply execute the `$ nest g controller cats` command.
40+
> info **Hint** To create a controller using the CLI, simply execute the `$ nest g controller [name]` command.
4141
4242
The `@Get()` HTTP request method decorator before the `findAll()` method tells Nest to create a handler for a specific endpoint for HTTP requests. The endpoint corresponds to the HTTP request method (GET in this case) and the route path. What is the route path? The route path for a handler is determined by concatenating the (optional) prefix declared for the controller, and any path specified in the method's decorator. Since we've declared a prefix for every route ( `cats`), and haven't added any path information in the decorator, Nest will map `GET /cats` requests to this handler. As mentioned, the path includes both the optional controller path prefix **and** any path string declared in the request method decorator. For example, a path prefix of `cats` combined with the decorator `@Get('breed')` would produce a route mapping for requests like `GET /cats/breed`.
4343

0 commit comments

Comments
 (0)