Typescript

JWT and Passport JWT Strategy for your NestJS REST API Project
| |

JWT and Passport JWT Strategy for your NestJS REST API Project

NestJS offers us the solo @nestjs/jwt module that allows us to integrate JWT in our project.
The Passport package is a massively used NodeJS library, whose “sole purpose is to authenticate requests, which it does through an extensible set of plugins known as strategies.
Here is a detailed post of how you can implement them in your project.

NestJS: Use a solo @injectable class as a singleton Provider
| |

NestJS: Use a solo @injectable class as a singleton Provider

NestJS Modules are Singletons by default. Their Providers are also singletons when they are provided from within the same module. However, there are cases where we want to use just a single solo class as provider to a couple or more modules. In such cases we can use the solo class as singleton or not. Let’s see how we can do that.

Step ahead fast, with NestJS environment configuration
|

Step ahead fast, with NestJS environment configuration

NestJS provides the necessary documentation for working with different environments (development, production, etc.) using external configuration files and environment variables. So, if you have already taken a look there, then the below provided cases, will give you a hand to start implementing your (relatively simple) project as well.

Typescript – How to solve the problem with unresolved path aliases in transpiled .js files
|

Typescript – How to solve the problem with unresolved path aliases in transpiled .js files

Here is a somehow detailed description of a well know issue related to the fact that the tsc compiler (transpiler) does not resolve/emit correctly the path aliases to the output JavaScript .js files. As a result, when you try to run the output file via node you get an error.
The solution presented here uses a tiny external specialized package and more specifically as a demo it uses the @ef-carbon/tspm.

Use a bash script to automate a Typescript-Node project scaffolding in your Mac
|

Use a bash script to automate a Typescript-Node project scaffolding in your Mac

Even in the case you are a newcomer, sooner or later, you will start boring the routine of repeating, again and again, the same actions.
Here there is a quite simple approach using just a pure bash shell script. No external tools or npm packages. Just a quick, clean and fast solution, especially handy for your very fundamental installations.