Quantcast
Channel: Active questions tagged express - Stack Overflow

How to avoid activation of insertMany() every time a server refreshes?

So I am trying to insert data in the database using Mongoose. Every time the server gets connected/refreshed .insertMany() runs thus inserting multiple copies of the same data in the database. I have...

View Article



Error creating folders in node.js with express and multer

I'm trying to do a server with node.js using express and multer, in which I can send an identifier and 12 photos to be stored in a folder. I'm using a multipart formdata but I'm facing a problem when...

View Article

EJS, Node.js: Trying to submit a patch request from a form doesn't reach...

I'm trying to submit a form from an EJS module using the method "patch", but I'm not getting expected results. I'm using a Postgres database, but I don't know if that matters because of the feedback...

View Article

Get collection size in bytes of mongoDB collection in nodejs [duplicate]

I am looking for a way to get the collection size of a mongoDB collection in nodeJS including the indexes.Is there any way to calculate the size of a collection (preferebly after a .find() statement to...

View Article

Express+React - Request IP always 127.0.0.1

I am making a React frontend with an express backend. For context, I am making a contact form that both stores information in a MySQL database and sends an email to myself and the user. Currently,...

View Article


Deploying ExpressJS Api to Vercel

currently im building a MERN stack project. Now i want to host my MERN in Vercel. The problem im encounter were, when i deploying it stuck at "Connected to MongoDB" and "Server is running on port...

View Article

Is it possible to generate a inventory report as json?

I am trying to develop a CRM with an Inventory Management System integrating the Amazon SP-API.I am doing this with nodejs and expressjs.I want to generate inventory reports and I´ve tried different...

View Article

Image may be NSFW.
Clik here to view.

Test not executing code inside subscription callback when using GraphQL Yoga

I have a very simple dummy server with: Node.js + GraphQL + Apollo Server & Link that I'm migrating to Yoga Server & Link.The Yoga version uses the same logic / idea as the Apollo version, just...

View Article


Unresolved dependency while upgrading project setup from v16 to v20.9.0 for...

I am using node v16.14.2 for my existing project. wanted to upgrad to v20 LTS. I have set node version to 20.9.0. and tried npm install, and got below mentione error.npm ERR! code ERESOLVEnpm ERR!...

View Article


My webpack is bundling my code very slow in React Express project

I have a monolith app it contains React and express. It bundles every time i change my code and it takes 30second in order to update my changes in the screen. Build time is approximatly 30 to 50...

View Article

Image may be NSFW.
Clik here to view.

Express handlebar error : Error: ENOENT: no such file or directory,

I am trying to send styled email with sendgrid, nodemailer@6.7.7, nodemailer-handlebars1 and expess-handlerbar@6the folder structure involving sendemailThe send email functionconst nodemailer =...

View Article

express-session not persisting when deployed in vercel

I'm using express-session and MemoryStore while deploying on Vercel. Although it generates an authentication cookie and sets it in the client, upon sending another request or refreshing, it redirects...

View Article

How to fix Error CORS policy when deploy ExpressJS [closed]

everything ok when use localhost to run server, but it has error Access to fetch at 'http:xxx' from origin 'http:xxx' has been blocked by CORS policy when i deploy app.I tried add mode:"no-cors" or...

View Article


razorpay double modal, double text and not responding in test mode

I think Razorpay is updating the frontend of the modal and is totally unresponsive in nature. On opening, I am getting double modals as well as double text whenever I write in any of the fields present...

View Article

Cannot extend express request

I'm trying to extend the Request interface of Express as:import express, { Request, Response } from 'express';interface IRequest extends Request { user: { id: string; }}const router =...

View Article


how does one get started using nodemailer using vs code?

i have installed node.js on my laptop. i have some html and bootstrap and css for the front end. i want the user to press the button sending me the details of the message so that i can send a...

View Article

NodeJS - Removing a variable from a text file (Replacing with nothing then...

Using the below code, I am storing one-time use tokens in a text file, upon being submitted in a POST, the script checks the file to see if it exists and then I need it to remove it. Currently, I got...

View Article


Timer ignoring checks and immediately starting in socket.io

The chat application is built on Node.js utilizing Socket.io and express for real-time client-server communication. The software is designed to handle up to 3 users and the chat doesn't start unless...

View Article

Access to localhost was denied You don't have authorization to view this...

I have a little NodeExpress server and when I try to make a request to the server it returns a 403 errorI have installed Cors and used it and tried with chrome browser and Postman as 2 clients and got...

View Article

Always Redirect to Failure

hello there I am new in learning about mongoDB,node js,Passport and express actually I was succefully able to create a working signup page but my problem is the sigin page like every time I am trying...

View Article

Spring security substitute for Node.js

Is there a substitute for spring security in Node.js. I know of express and passport, but passport provides authentication only. It does not feature "forgot password", "reset password" or crud...

View Article


Transaction Management in nodejs with mysql

I am working on nodejs with MySQL. I need to implement transaction management while inserting data in to multiple tables. So that I can rollback all insertions if any error occur. All DB related...

View Article


How to passthrough a filestream in nestjs without a physical file?

I want to passthrough a file upload in nestjs. Currently the only solution I was able to do was to create a physical file and then read from that:export type RequestHeaders = {'content-type':...

View Article

Neither express.json() body-parser not parsing form-data

I was doing youtube clone, during sign up process I got issues with sending data on form-data so my mongoose schema like this:const { Schema, model } = require("mongoose");const userSchema = new...

View Article

mantine Menu.dropdown not working I have paste same code from their Website

I am watching a tutorial in which he used mantine Menu, so inside it he used Menu.Dropdown in which he add some items which works fine in his video, but now when I am working on it I got error and it...

View Article


SCRAM-SERVER-FIRST-MESSAGE: client password must be a string

Ive read documentation from several pages on SO of this issue, but i havent been able to fix my issue with this particular error. throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must...

View Article

Can we update two data fields in a single query

const query='Update data set name =?, date=? where id=? 'This query throws error, is there any other way to write it?I tried updating two data fields at same time.can we update two data fields in a...

View Article

Error message "ENOENT, no such file or directory"

I'm getting this error from my Node.js application:ENOENT, no such file or directory '~/Desktop/MyApp/newversion/partials/navigation.jade'I know the file is there because when I try to open the file...

View Article

error when making request in test using mocha with chaiHttp

I try to use chai to make a request to my API on the /login route, but it cannot complete, I can use the same structure to do it for another route but it is not working in the best way.enter image...

View Article



Express.js: Too Many Redirects Issue When Implementing Role-Based...

Encountering an issue with Express.js and Passport.js while implementing role-based authentication. Despite setting up role-specific middleware, I'm facing a 'Too Many Redirects' error. The application...

View Article




Latest Images