94,958 questions
0
votes
0
answers
36
views
Deploying Node.js Backend on VPS (ubuntu) with Nginx web server [closed]
I need your guidance on something, please.
I recently bought my domain name (anexiums.com) and hosting from asurahosting, and then created a subdomain (api.anexiums.com) which I'm supposed to deploy ...
3
votes
1
answer
65
views
Cannot send data to Node Express after converting from CJS to ESM
After having carefully converted my JS code for NodeJS from CJS to ESM (with some unexpected difficulties), I am failing to send a body content to my Node Express web server, running for test purposes ...
0
votes
0
answers
20
views
Express Admin Panel Routes Not Working on cPanel with Passenger (React App Works Fine)
Problem Summary
I have a Node.js monorepo with both an EJS-based admin panel and a React frontend. The app works perfectly on localhost, but when deployed to cPanel with Passenger, only the React app ...
-4
votes
0
answers
37
views
How to Implement a Proper Error Handling Architecture in a Node.js/Express Server? [closed]
I’m building a Node.js backend (using Express + TypeScript) and I want to implement a clean, scalable, SOLID-friendly error handling system.
My goal is:
Developer Side: Print a detailed error log in ...
-3
votes
0
answers
53
views
HTTP Put Request Not Updating But I Still Get A 200 Status Code
Whenever I try to update an object from the genres array using the code below, nothing happens. I get a 200 status code but the object remains the same with no updated value. where could I be going ...
Advice
0
votes
1
replies
34
views
Deploying an express.js package
I am creating a web application using express.js. I have been following a course by Angela Wu, and one of the chapters involves a templating tool called 'Express' which is built on node.js. Following ...
-3
votes
0
answers
29
views
Express.js: "Cannot set headers after they are sent to the client" error with MongoStore sessions - page renders correctly Error [ERR_HTTP_HEADERS_ERR [duplicate]
I'm getting the error Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client in my Express.js application using MongoDB session store, but the page displays correctly in ...
-2
votes
0
answers
75
views
JWT authentication: req.user is undefined in protected routes even though token is valid [closed]
I'm implementing JWT Authentication in a full-stack (React + Node.js + Express) application. Login works, token is generated correctly, and the client sends it in the Authorization header.
However, ...
-5
votes
0
answers
62
views
Download button not asking for location in Firefox (but in Chrome does) [closed]
I have following two files (server.js and index.html) which together should allow me to download a file using nodejs server (ran by node server.js). It does happen when I click the link but only in ...
1
vote
0
answers
31
views
Flutterwave Webhook Not Triggering in Production (Works on Development)
I am integrating Flutterwave payments in my project(Node.js/Express).
In development, deposits work correctly:
User pays;
Flutterwave triggers the webhook;
Payment gets verified and the user balance ...
3
votes
1
answer
102
views
Does creating multiple JWT authentication tokens mean multiple server sessions for concurrent requests?
I'm participating in an online Sudoku-solving challenge where you create an account, and the server gives you a JWT token. Every request (getting the board, submitting answers, etc.) must include that ...
1
vote
1
answer
109
views
How to disable "body-parser" globally in NestJS and use it on specific routes?
If I have understood correctly, the NestJS with default Express engine uses and enables the "body-parser" as default. If so, I am not fine with it because most requests has GET-type, and for ...
0
votes
1
answer
58
views
How can I add API common prefix for controllers
I want to add an API common prefix for all controllers, e.g. /api/v1. I am using inversify with the @inversify/http-express package.
Here is my current base server adapter setup:
class Server {
...
1
vote
0
answers
30
views
Bun + Express on Vercel: How to Modularize Routes from Separate Files?
I'm deploying a Bun + Express application to Vercel. Locally, my Express app works perfectly with routes defined in separate files and imported into index.ts. However, on Vercel, the deployment ...
0
votes
2
answers
85
views
I am having an issue with TypeScript and express-jwt
This is TypeScript code that I wrote a couple of years ago:
import { expressjwt } from "express-jwt";
import { Request } from 'express';
class Authentication {
static loginRequired() {
...
-4
votes
1
answer
45
views
express server ts compiller errors: library diff and declare global namespaces
When I work in development mode via nodemon, there are no problems. After that, I started preparing the code for production. At first, the "tsc" command worked without errors, and then I ...
Best practices
1
vote
3
replies
44
views
Athena health api documents
I’m trying to build an application that can download patient documents from Athenahealth, but I can’t figure out whether this is actually supported. The official API documentation is extremely limited ...
0
votes
1
answer
67
views
How to send cookies from server to client during SSR (Angular 20)
I am using HttpOnly Cookies for JWT authentication in my Angular v20 app. I have SSR enabled.
During Login, the cookies are sent to the client. I have an HttpInterceptor that seems to work to forward ...
Best practices
1
vote
3
replies
73
views
How can I optimize my nodejs backend code for live data emiting for dashboard in UI
So I am working on a MEAN stack project where in node I will emit the data to UI and in frontend I had some widgets ( as charts like gauge , line , pie and table ) where user can add dynamically ...
-4
votes
1
answer
111
views
Cant calling API from my server because of CORs [duplicate]
I am making a todo desktop app which run locally on user's device. I am using Electron Forge + Vite + ReactJs and ExpressJs.
Folder structure:
src/
├─ db/
│ └─ database.js
├─ main/
│ └─ index.js
├─ ...
-3
votes
0
answers
73
views
Role and permission management for RBAC Express.js +TypeScript project
I need to implement role-based access control on the backend with postgresql, Prisma, and Express.js+TypeScript and the roles I have in mind so far are admin, manager, customer, delivery crew. I want ...
-1
votes
0
answers
57
views
Argument of type 'PoolConnection' is not assignable to parameter of type 'never'
I want to mock transaction as PoolConnection
jest.mock('../../src/config/db.js', () => ({
__esModule: true,
default: {
execute: jest.fn(),
query: jest.fn(),
...
1
vote
2
answers
118
views
How to declare type for app.locals.something?
It's the same question as How do I extend the typings of Express.Application to give typings for app.locals but the suggested solution doesn't work for me.
I have server.ts :
const express = require('...
3
votes
1
answer
59
views
Query not printed as expected
exports.getAllProducts = async (req, res) => {
try {
console.log(req.query);
const queryObj = { ...req.query };
const excludedFilters = ["page", "limit", "...
2
votes
0
answers
87
views
Every day, the first and only the first backend call of my Node/Express app in production fails with ERR_CONNECTION_RESET or ERR_CONNECTION_REFUSED?
I have a basic MERN app in production with a login system that always runs into either an ERR_CONNECTION_RESET or an ERR_CONNECTION_REFUSED AxiosError when first attempting to login after what it ...
0
votes
0
answers
54
views
FIDO2 Fingerprint Verification Fails in Production (Works on Localhost) – Express.js + fido2-lib
Context
I’ve implemented FIDO2 verification for login and signup on my Express.js website. Everything works perfectly in localhost, but in production, the fingerprint verification of my security key ...
2
votes
1
answer
105
views
How to add data from a client-side input field to my array websites[name] and then display it in html document
How to add data from an input field in the browser to my array websites[name], and then display it in a html paragraph?
server.js
import express from "express"
import { websites } from "...
0
votes
2
answers
95
views
Running `nodemon server.js` opens `nodemon.js` file in text editor instead of executing
I installed nodemon globally and locally I added it to the environment path. I tried to use flags but nothing works
One month ago (last time I used it), it was running completely fine. Now it's ...
2
votes
1
answer
103
views
How can I make my Node.js backend code cleaner without using an ORM when working directly with SQL?
I'm building a Node.js backend using plain SQL (no ORM, just mysql2 wrapped in a small helper).
However, as my project grows, my route handlers start looking messy — full of raw SQL strings embedded ...
1
vote
0
answers
63
views
How to properly transform backend error responses using response-transformer or custom policy in Express Gateway?
I'm working with Express Gateway to proxy requests to a backend service and want to transform error responses into a common format like this:
const errorResponse = {
timestamp: new Date()....
1
vote
0
answers
61
views
Express' res.clearCookie() does not clear the cookie?
I assign the cookie here:
const sessionEnd = new Date(Date.now() + ( 1000 * 60 * 60 * 24 ));
const cookieOptions = {path: "/", expires: sessionEnd, httpOnly: false};
async function ...
0
votes
1
answer
58
views
Socket io is not connecting from Angular to backend nodejs
So I am trying to build a dynamic dashboard application ,so I use socket io 4.8.1 , and In frontend as well I installed the same version , now I used polling socket io it actually worked with polling ...
2
votes
0
answers
77
views
Multer returns req.file undefined when uploading image with Hoppscotch in Express
I'm building a Node.js + Express backend where users can upload profile pictures using Multer. When I send a POST request from Hoppscotch to /update_profile_picture, I get this error:
Cannot read ...
0
votes
0
answers
62
views
how to pass the uploaded assets URL directly to the front-end without using Presigned URL?
It's my first time using CDNs, and I went with Cloudflare R2 / S3 to upload and serve assets. I managed to upload an image to the path users/123456789/avatar-251011-103221008, this path is what I'm ...
-3
votes
1
answer
192
views
"Cannot set property query of #<IncomingMessage> which has only a getter" when using express-mongo-sanitize or xss-clean
I'm using Express 5, and I'm now running into this error when using express-mongo-sanitize or xss-clean:
TypeError: Cannot set property query of #<IncomingMessage> which has only a getter
In ...
0
votes
0
answers
52
views
Why is the return statement in my express.js route not stopping execution of the middleware that is placed after it?
The return statement in /routes/todos.js is not stopping the execution of my app. Instead, the the "Handle 404 Errors" app.use() function that is placed after app.use("/todos", ...
0
votes
0
answers
69
views
multer.memoryStorage() file undefined or Error: unexpected end of form
I'm trying to upload a file to the OpenAI API using Firebase Cloud Functions, Express and Multer. I have a React UI that I'm using to upload a file to my back end to then send to the OpenAI API, but I'...
0
votes
1
answer
46
views
VS Code Port Forwarding not setting cookies
I have a React application running on port 5173 and an Express server on port 3000. I'm trying to test Google OAuth sign-in from my React app using my actual mobile phone.
When I access the app from ...
0
votes
0
answers
33
views
EJS error: include is not a function when using <%- include('partials/sidebar', { user: user, page: 'invoice' }) %>
I'm working on an Express + EJS project and getting this error when rendering my invoice.ejs view:
TypeError: C:\Users\naray\OneDrive\Desktop\Invoice-saas\invoice-generator\views\invoice.ejs:17
>&...
1
vote
2
answers
107
views
Why won't my React app render a simple "Loading" text which is connected to a state?
My HomePage.jsx looks like this:
import {
Box,
Container,
SimpleGrid,
Text,
useColorModeValue,
VStack,
} from "@chakra-ui/react";
import { useEffect, useState } from "react&...
1
vote
0
answers
58
views
Augmentation merging
I'm running into a type augmentation conflict with Express when trying to enforce stricter types for req.user.
In one of my dependencies, Request is augmented like this:
declare module "express-...
0
votes
0
answers
59
views
MedusaJS cookies not set with SameSite=None for cross-subdomain admin panel (Nginx + VPS)
I'm self hosting a MedusaJS backend on a VPS, serving both a store (studyswags.pk) and an admin panel (admin.studyswags.pk) on separate subdomains.
I want authentication/session cookies to be ...
1
vote
2
answers
251
views
OpenAI API with Express/TypeScript throws Missing credentials after moving API key to .env
I’m building an app with NodeJs, Express and TypeScript.
At first, I hardcoded the OPENAI_API_KEY directly in my code for testing, and it worked fine.
Now, I’ve moved the key to a .env file because I ...
0
votes
0
answers
31
views
Adobe Express Script Not Selecting one Particular object in Function
I'm self-taught when it comes to the Adobe Scripts, so I don't know what's going on.
This is a shortened version of the function I'm working on; the full version will have different objects being ...
1
vote
1
answer
33
views
Merging custom user property into Express Request for keyGenerator
I’m trying to create a keyGenerator function for express-rate-limit that uses user.id as the key:
import rateLimit from 'express-rate-limit';
rateLimit({
limit: ...,
windowMs: ...,
message: ...,...
0
votes
3
answers
115
views
Issue in connecting with MongoDB
I'm having an issue connecting my server to a MongoDB database, I've added the code I used and the error I got below. I've consulted with ChatGPT, and it suggested an SRV DNS resolution issue, but ...
0
votes
0
answers
42
views
Sequelize bulkCreate fails with duplicate entry error despite non-duplicate data and updated unique constraints
i am trying to migrate the dataset in mysql database being the role_id and module_id same mysql is refusing to store saying
sqlMessage: "Duplicate entry '3-1' for key 'role_module_bridge....
1
vote
0
answers
121
views
Why does my API call in Next.js return undefined even though the Express backend works fine?
I’m building a small full-stack project using Next.js (frontend) and Express.js (backend) with a MySQL database.
The Express backend has this route:
// server.js
import express from "express&...
0
votes
0
answers
47
views
Getting Undefined in body while hitting post request through postman
import { DBCon } from "./db/index.js";
import express from "express";
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
DBCon()
....
1
vote
1
answer
132
views
Nodejs backend endpoint not hitting consistently. Using nginx, ec2
I have a game where people can draw and guess, similar to scribble.io. I'm using Nginx for load balancing, hosted on AWS, with a backend written in Node.js.
The problem I'm encountering is that my ...