Skip to content
Advertisement

Tag: express

How to deal with NestJS @Get() decorator?

This block of code works properly. I’m able to access both functions with the URL http://localhost:3000/vehicle/availableVehicles & http://localhost:3000/vehicle/1 accordingly But when I just swap between the 2 functions like code block below then the function availableVehicles() doesn’t work & the URL http://localhost:3000/vehicle/availableVehicles hits the getbyId() function. What to do? Or what I’m doing wrong? Thanks in advance. Answer You just

How can I get returned string values in fetch()

Below code is my fetch method in my separate register.js. This is my newly created js file, so I can create my front end. At the moment I’m just trying to console.log the ending result for this fetch, but can’t get the output since I’m getting an error when I try to POST this. error in browser console: “Uncaught (in

Method returns undefined the first time it is called

I have a method that selects distinct values from a database as shown below: I then have a button with the method POST and action /categories The displayCategories is called when the button is clicked as follows: I added some console logs for test purposes. The issue I am having is that the first time I click the button, it

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