Skip to content

Tag: nestjs-config

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