Category "express"

Using axios.post, response.data return html instead of data [Nodejs, React]

What I want is, when I click SUBMIT button, it should post some data using axios.post const sb = async () => { axios.post('/tagSearch',{ qual: qual

MongoParseError: URI does not have hostname, domain name and tld

I'm getting this error when I try to connect my app(nodejs) to mongodb. I really appreciate your help here. MongoParseError: URI does not have hostname, domain

Moment.js startOf is returning end of day

I am passing in the following date through query string: 2020-09-23 I am trying to figure out why the below code with the doesn't work comment above it is not w

Not able to add more than 1 post request in the mongo db

i am using mongo db to fetch and post the data but unable to post more than 1 request here is my code ON posting the different values second time i am getting t

How to make 301 redirect in NextJS Vercel project?

How can I make 301 re directions from one url to another in NextJS application that is stored on Vercel? I tried to add custom express server using server.js fi

How can i get specific error messages from a Mongoose Schema?

I am trying to set up user validation in Mongoose and struggling to get the specific messages to appear. Here is my model const userSchema = new Schema({ n

Appending a Prefix to Routes in One File in Express JS

I am currently refactoring my code and I am hoping there is a more efficient way to make my code look pretty. Here is what I currently have: router.route('/ap

Appending a Prefix to Routes in One File in Express JS

I am currently refactoring my code and I am hoping there is a more efficient way to make my code look pretty. Here is what I currently have: router.route('/ap

How to deploy my app to heroku when i have two different folders

I have a project with two defferent folders. One is frontend the another is back-end. I want to deploy this both folders on one heroku app. In the server.js i h

Node js express error hanlding middleware dont recognize 4 elements

I'm trying to create an error-handling middleware, and as you can see in the image attached when I'm making the app.use((err,req,res,next) => {...}) block

How to log - the 12 factor application way

I want to know the best practice behind logging my node application. I was reading the 12 factor app guidelines at https://12factor.net/logs and it states that

How to use Jest global Setup and Teardown in a nodeJS project?

I added tests to my node js project using jest but for each test suite there's a beforeAll method that creates a new test server and connects to a mongo databas

Node.js - PostgreSQL (pg) : Client has already been connected. You cannot reuse a client

I am just trying to write simple register/login system. I am trying to find if username exists. Here is the steps : Go localhost:3000/users/register page Fill i

multer file upload req.file.path undefined put request

I've created a simple RESTapi with express and for file upload I'm using multer. Creating a new item / post works. My issue is with the put route and the functi

Unable to connect MongoDB server?

I have tried to connect to MongoDB server using the below-mentioned link but I am getting an error, I have entered the correct password and dbName but it couldn

How to call a GraphQL query/mutation from an Express server backend?

My frontend is localhost:3000, and my GraphQL server is localhost:3333. I've used react-apollo to query/mutate in JSX land, but haven't made a query/mutation f

Access raw body of Stripe webhook in Nest.js

I need to access the raw body of the webhook request from Stripe in my Nest.js application. Following this example, I added the below to the module which has a

NodeJS + Express + Socket.IO : CANNOT GET ERROR

I'm programming chat app using socket.io . Chatting works well but trying to get 'http://myurl/upload', it give me the error"cannot GET//uplad". What is the pro

Cannot create property 'ignore_whitespace' on string ' '

const Validator = require("validator"); const isEmpty = require("../validation/is-empty"); module.exports = function validateRegisterInput(data) { let errors

Not able to get response , showing Operation `users.findOne()` buffering timed out after 10000ms`

I am facing an error while making the POST login request. I had deployed the frontend on Netlify here and the backend on Heroku here. This is my backend logs ht