Style guide of naming conventions
In this part, we will see the naming conventions that we can use in order to have better maintainability and readability. For each decorator, you should use the name with a hyphen for a composed name, followed by a dot and the name of the decorator or object to which it corresponds.
Controller
The naming of the controller should respect the following principle:
user.controller.ts
@
Controller
()
export
class
UserController
{
/* ... */
}
Service
The naming of the service should respect the following principle:
user.service.ts
@
Injectable
()
export
class
UserService
{
/* ... */
}
Module
The naming of the module should respect the following principle:
user.module.ts
@
Module
()
export
class
UserModule
{
/* ... */
}
Middleware
The naming of the middleware should respect the following principle:
authentication.middleware.ts
@
Injectable
()
export
class
AuthenticationMiddleware
{
/* ... */
}
Exception filter
The naming of the exception filter...