Skip to content
Advertisement

Tag: nestjs-config

NestJs ParseEnumPipe can’t be resolve

I am using the NestJs framework (love it by the way) and I want to check the incoming data so it conforms with an Enum in Typscript. So I have the following: The weird thing is that when I run this code, the first pipe gets compiled What I am doing wrong? Answer You should use @Body(‘action’, new ParseEnumPipe(ProductAction)) action:

Reading PORT number from .env file in nestjs

I have details defined in .env file. Below is my code. host: process.env.SMTP_HOST is working properly. but when I am writing process.env.SMTP_PORT it is saying you can not assign string to number. when I wrote parseInt(process.env.SMTP_PORT) it is still not working. how to assign port from .env file Answer port: +process.env.SMTP_PORT should work casting it to a number. If there

Advertisement