I’m making a simple GET and POST with NodeJS and Express just for learning a little about PrismaJS with MySQL database. I want to pass the value of the array grouped to the creating function, when I use console.log(grouped) inside the map function I have the values I want, outside it keeps empty [], also when I’m passing him to
Tag: express
CORS Policy blocking my API requests in a google cloud platform app engine in a live website
I uploaded my node js server to the google cloud app engine service to be able to make the front end work. I also uploaded the frontend and my website is now live. The node js is running fine and it’s deployed in the app engine in google cloud. my only problem is that whenever I try to make a
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
Error: Route.post() requires a callback function but got a [object Promise]
I am creating a REST API with express, folowing are my architecture,a router is calling a controller.but I got this error, please help me /////// EmailLogin.js middleware Handler I’m trying to call it in my router, like this: /////// Router.js /////// App.js What could I do ? is it possible to get a Promise Result in the Router as a
Uncaught (in promise) SyntaxError: Unexpected end of JSON input error
This is simply add to cart function. Also means insert field to database. All is fine when it comes to adding to the database, however there is this error everytime I click add to cart(But still adds to database though). Here is my fetch code, leading to calling my controller. I’m not sure what json data is being returned here,
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
Is it normal that I am able to invoke firebase cloud functions from any kind of frontend app?
I am using axios to call the firebase cloud functions I have created with express/firebase. I realized even without using and without importing the firebase and without initializeApp(firebaseConfig) in my frontend, I was able to call my cloud functions with the axios with the following way: How I create cloud functions: index.js foo.js Is this a normal behavior or is
How to export function as function expression in express node js
I have a function I am exporting this in the main route file But when I running the code it’s giving this error Error: Route.post() requires a callback function but got a [object] Object What I am doing wrong? Answer You’re trying to use the exports object as though it were a function. If you want to only export the