94,957 questions
2
votes
1
answer
73
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 ...
0
votes
1
answer
42
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 {
...
0
votes
1
answer
66
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
36
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
41
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 ...
Best practices
1
vote
3
replies
65
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 ...
-3
votes
0
answers
66
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
vote
2
answers
106
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('...
2
votes
0
answers
79
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 ...
2
votes
1
answer
94
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 "...
2
votes
1
answer
100
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
53
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 ...
2
votes
0
answers
63
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 ...
-3
votes
1
answer
148
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
63
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
0
answers
27
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
0
answers
55
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-...
1
vote
2
answers
221
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 ...
1
vote
1
answer
29
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
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....
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()
....
0
votes
1
answer
94
views
How to fix 404 error when deploying Node.js backend on Vercel with Vue frontend on Netlify?
I have split my Vue.js project into two parts:
The frontend is a Vue app, which I successfully deployed to Netlify, and it works fine.
The backend is a simple Node.js + Express server that I want to ...
1
vote
1
answer
87
views
Unable to output successfully compiled react component into DOM
I've trying to integrate react into an existing project. I'm starting by setting up a simple button component to get started. The project is an express app that uses handlebarsjs to handle the views.
...
0
votes
1
answer
211
views
Express 5 optional route parameters (:param?) throw PathError with path-to-regexp
I'm using Express 5.1.0 with Node.js v22.19.0, and I want to define a route where the parameter is optional, like /directory or /directory/someFolder.
Here's the code I tried:
import express from '...
1
vote
0
answers
47
views
Href in my html file returning "Cannot Get" (PM2)
I have this coding in my index.html:
<!-- Href Hyperlinks -->
<a href="index.html">Trade Bot</a>
<a href="raffles.html">Monthly Raffles</a>...