I send requests using postman. And when I send request “POST” for create product (or another requests: GET, PUT , etc), I have problem: I can’t figure out how I can send a query to my database to get this right. I use express, sequelize and sequelize-cli, mysql2. And also i have migrations file. My server.js productRouter.js productController.js productModels.js product.js
Tag: express
Return results in a nested object
I am trying to loop through the req.body that has data and I am trying to return the bookStatus of all the books present inside the body. I am doing this: This returns the bookStatus of all the books, but it is just the value of the bookStatus key. I am trying to get the key as well, for it
login rest api using express giving HTML content error in postman
I am trying to create a simple login api using node js and express, however postman is giving the following error however my signup api is working fine and I can create my user profile and am getting response code that I have written for login is as follows: signup api: routes are as follows: I am very new to
Axios POST request sends data to Express server but Error 404
Axios POST request sends data to Express sever but Error 404 Hello, world, I am trying to build a user authentication server for a project I am working on, but I am running into a problem trying to send a POST request to my Node.js Express server. I want to send a POST request using Axios containing a username and
Cannot Delete and getting 404 not found error in router.delete
In my application, i am passing the request param id in router.delete and communicating that with vuex service. While triggering action api is fired but getting 404 not found and there is not request payload as well. Express route.delete Vuex service vuex actions component action trigger It is showing in api response server.js Answer Since your api endpoint is this:
Express.js app times out when attempting to query a PostgreSQL database
I’ve built an Express.js app, hosted by Heroku, with a non-embedded PostgreSQL database. The app was running as intended until about a month ago, and for several months before that. However, when I logged in today, I ran into a serious problem. Whenever I try to access any page which queries the database, it tries to load for a few
How do I query the database using Mongodb after I set up a Mongoose schema for authentication?
I successfully set up authentication for my app, which is a node.js (Express) app. I used Passport-local and I also used a Mongoose schema. The folder structure is like this: Inside the “models” folder is the User.js file, and it contains this schema: And the app.js (the main file) includes the following code. I am not showing everything by the
editly – Where can I get the return value after a video is created?
Quick question… Following along the README of editly, I managed to create videos after calling editly like this: Unfortunately, I am using ExpressJS to do this and I need to send back a response when video creation completes. However, when I tried to extract any value using .then, it returns undefined: How can I accomplish this? Answer For anyone who
Encountering a problem when trying to insert JSON data into my postgres database – Node.js
I’m having a problem when i try to save my JSON data into a database. Right now, i have this code here: My service that retrieves and cache data from an API with the given parameter cep: My route using the service: It works with out problems: Here that comes the problem. When i try to insert the data into
Async and promise function do not display anything in my res.json call
I have a controller in javascript which should get a given user, and then the pets that are associated with the user. The related pets are stored in an array of object refs within the user schema. At the minute, when I try to res.json the resulting array containing the related pets, it outputs as an empty array ‘[]’. Following