Skip to content
Advertisement

Tag: backend

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

How to log user input with Morgan?

Good morning, I am trying to log user input from user when using morgan and express. What I am specifically trying to log is noted in this image: (The user posted a request with an object that includes two key/value pairs “name” and “number”) How would I go about logging this? Custom tokens or is there a predefined method I

path broke when uploaded to server (link from js to html)

I programmed a webside and a bunch of it broke when I uploaded it onto the server (until now I only ever programmed locally and not very often at that) I fixed nearly everything but the links between pages. What works is the “a” element in html to link but most of my pages are linking to oneanother in their

How create a spam filter in express.js or how to filter objects based on the word in the key values?

I want create simple spam filter. I dont have an inbox yet but I was thinking when the emails are recived I could make a GET request and filter the object based on the words mentioned in the message. If the posted object is [{“id”:”1″ “email”:”xyz@gmail.com”, “cc”: “abc@gmail.com”, “message”: “You have a chance to win a lottery and be a

Advertisement