Node.js/Nest
-
Custom DecoratorsNode.js/Nest 2023. 12. 8. 17:29
Nest.js의 Custom Decorators에 대해 정리하였습니다. You can create your own custom decorators. Ex : @User( ) decorator In the node.js world, it's common practice to attach properties to the request object. Then you manually extract them in each route handler, using code like the following: const user = req.user; In order to make your code more readable and transparent, you can create a ..
-
GuardsNode.js/Nest 2023. 11. 21. 15:31
Nest.js의 Guards에 대해 정리하였습니다. Guards have a single responsibility. They determine whether a given request will be handled by the route handler or not, depending on certain conditions (like permissions, roles, ACLs, etc.) present at run-time. This is often referred to as authorization. A guard is a class annotated with the @Injectable( ) decorator, which implements the CanActivate inter..
-
PipesNode.js/Nest 2023. 11. 13. 17:50
Nest.js의 Pipes에 대해 정리하였습니다. A pipe is a class annotated with the @Injectable( ) decorator, which implements the PipeTransform interface. pipes operate on the arguments and have two typical use cases: transformation: transform input data to the desired form (e.g., from string to integer) validation: evaluate input data and if valid, simply pass it through unchanged; otherwise, throw an ..
-
Exception FiltersNode.js/Nest 2023. 10. 30. 16:52
Nest.js의 Exception Filters에 대해 정리하였습니다. Nest comes with a built-in exceptions layer which is responsible for processing all unhandled exceptions across an application. When an exception is not handled by your application code, it is caught by this layer, which then automatically sends an appropriate user-friendly response. : Out of the box, this action is performed by a bui..
-
MiddlewaresNode.js/Nest 2023. 10. 18. 17:22
Nest.js의 Middlewares에 대해 정리하였습니다. Middleware is a function which is called before the route handler. Middleware functions have access to the request and response objects, and the next() middleware function in the application’s request-response cycle. The next middleware function is commonly denoted by a variable named next You implement custom Nest middleware in either a function..
-
ModulesNode.js/Nest 2023. 9. 26. 14:49
Nest.js의 Modules에 대해 정리하였습니다. The @Module( ) decorator provides metadata that Nest makes use of to organize the application structure. A module is a class annotated with a @Module( ) decorator. The @Module( ) decorator takes a single object whose properties describe the module: providers the providers that will be instantiated by the Nest injector and that may be shared at least acro..
-
ProvidersNode.js/Nest 2023. 9. 8. 16:54
Nest.js의 Providers에 대해 정리하였습니다. The main idea of a provider is that it can be injected as a dependency; this means objects can create various relationships with each other, and the function of "wiring up" these objects can largely be delegated to the Nest runtime system. Many of the basic Nest classes may be treated as a provider – services, repositories, factories, helpers, and so..
-
ControllersNode.js/Nest 2023. 8. 23. 18:18
Nest.js의 Controllers에 대해 정리하였습니다. Controllers are responsible for handling incoming requests and returning responses to the client. A controller's purpose is to receive specific requests for the application. The routing mechanism controls which controller receives which requests. Frequently, each controller has more than one route, and different routes can perform different actio..