Questions tagged [express]
Express.js is a minimal and flexible Node.js web application framework providing a robust set of features for building web applications.
express
94,787 questions
-3
votes
0
answers
35
views
How to use async function in the router?
I have a simple code thet works fine:
...
0
votes
0
answers
18
views
Use Nextjs and external backend Setup
So I was trying to use Next.js and Express. I used Next.js only for frontend and SSR (ssr for some pages only). How can I add protected routes in Next.js in this two server setup?.
Normally, we would ...
-5
votes
1
answer
82
views
Request body of Postman request to Express/Node API appearing blank server side
I have a request going from Postman to a Express/Node server locally.
GET requests to the same endpoint are working as expected but when I ...
-4
votes
0
answers
55
views
Error: querySrv ECONNREFUSED _mongodb._tcp.cluster0.tigfrse.mongodb.net [duplicate]
This is my code to connect with MongoDB Atlas
...
-4
votes
0
answers
65
views
Express backend application keeps crashing locally [closed]
I have been working on a backend project for some months. It was working fine until when I had issue with the MongoDB Compass connection which I successfully fixed (lost data in the process).
However, ...
0
votes
1
answer
45
views
How do I solve Shopify's Oauth matching hosts error?
I'm building a small backend as a learning exercise with node.js, express, typescript, and the shopify api.
My server runs fine and successfully goes to the home "/" page, but when I try to ...
Best practices
1
vote
2
replies
23
views
Dynamic PATCH route vs. one PATCH route per user profile field
I just want to ask about this design issue I just encountered when I'm coding this edit-profile part for the user. I'm deciding on whether I should or should not individually code the patch routes, ...
6
votes
1
answer
296
views
MongoDB Atlas SRV connection fails with querySrv ECONNREFUSED after switching Node versions (Node 22, Windows)
I’m running into a MongoDB connection issue that only appeared after switching Node.js versions, and I haven’t been able to resolve it despite extensive troubleshooting.
Environment
OS: Windows 10
...
0
votes
0
answers
37
views
How to implement SEO-friendly 301 redirects for old Shopify URLs in a PERN stack app (Next.js + Express + Prisma + PostgreSQL)
I’m migrating my e-commerce store from Shopify to a custom PERN stack application, and I need to implement permanent 301 redirects from old product and category URLs to new URLs while preserving SEO.
...
1
vote
1
answer
122
views
Error when implementing auto-increment functionality using 'mongoose-sequence': "TypeError: next is not a function."
I am having trouble with the implementation of the mongoose-sequence library in my MongoDB, Express, Node.js API.
This project is one for adding people to a ...
-2
votes
1
answer
116
views
How to add second piece of middleware into API controller structure? [closed]
I have a piece of middleware that authenticates a token that is being sent in a post request. My project is written in Typescript with express backend.
Below is how I have integrated my middleware at ...
1
vote
1
answer
64
views
sqlite timezone change UTC to asia/kolkata
I am creating a crud application using Node JS, Express JS & SQLite database. For every database insertion i am using a column 'created_at' to insert current timestamp. But according to my ...
2
votes
1
answer
76
views
Is it possible in Node to wait for a success/error from a net.socket operation before sending an Express response?
I apologize if this is impossible, unadvisable, or answered elsewhere, but I have spent a couple days trying to find an answer as well as changing/testing the code every way I could think of without ...
0
votes
1
answer
76
views
__dirname is not defined when updating user profile with file upload
I am building a Node.js application and trying to update a profile with file upload functionality using Multer. When I try to delete the old profile picture then I ...
1
vote
1
answer
72
views
How do I specify that CN=<container_name> and localhost at the same time for openssl self signed certificates between postgres and express?
Postgres is running inside a docker container named postgres_server.development.ch_api
Express is running inside another docker container named express_server.development.ch_api
I am trying to setup ...
0
votes
1
answer
55
views
SendGrid email content sometimes renders in wrong format using Node.js + Express (Dynamic Templates & HTML)
Tech stack
Node.js
Express.js
@sendgrid/mail
SendGrid (Dynamic Templates and HTML templates)
Sometimes, emails sent via SendGrid are rendered in an incorrect or broken format (layout issues, missing ...
2
votes
1
answer
57
views
Mongoose Model.save() not working inside a loop
I'm working on an Express controller to update product's inventories when saving an order. Below is the code to recalculate sold & sellable amount of a product.
...
1
vote
1
answer
49
views
In the header "Content-Type: application/json; charset=utf-8", do spaces after colon matter for express?
I'm currently learning Node and express and ran into this recently. If I put spaces after the colon in my header, the request body in node for POST shows up as ...
Advice
0
votes
2
replies
48
views
How to design profile view email notifications using Node.js, Bull queue and Redis?
I have a social networking site where people connect, meet and build network. User created their profile based on there interest. Users can visit others people profile and send connection request to ...
Best practices
0
votes
1
replies
65
views
Node.js Express v5 generate sitemap with all registered routes
I need some help... I have code like below:
main/index.js
...
1
vote
1
answer
106
views
Can AbortController be used with Fetch Post requests without automatically triggering a close event?
Question: Is it possible to use AbortController with POST requests without immediately triggering a 'close' event on the server? If not is there a more appropriate tool / method to cancel post ...
Best practices
0
votes
0
replies
70
views
Best approach to dockerize Nodejs Backend with API endpoint and scheduler
The API endpoint is using the Express.js package while the scheduler is using the bree.js.
The previous approach is to wrap the scheduler starting program into a function and start the scheduler when ...
Best practices
0
votes
0
replies
42
views
How to implement email verification using Express JS with React native expo?
I am planning to build a project using an Express JS REST API with React native. I am wondering how email verification is usually handled with this kind of stack.
A flow is:
User registers with ...
1
vote
1
answer
79
views
How does the express session know that I altered the session property?
I'm trying to understand express-session, and I'm still new to Express.
From the Express docs, I learned that when I write:
...
0
votes
0
answers
77
views
Socket connection issue in react-native and nodejs
I’m currently working on a logistics app that manages goods transportation in my area. The tech stack includes React Native for the mobile app, Node.js / Express.js for the backend, MongoDB as the ...
-1
votes
1
answer
68
views
Node JS page not displaying [closed]
I can get Express to serve plaintext pages, but I'm trying to get it to serve HTML
All I get in the web browser is "Cannot GET /concerts"
...
Advice
0
votes
2
replies
69
views
How to use contentFor() in express ejs layouts?
I have been trying to find a video or explanation on how to use contentFor(). I already read the documentation, but it is still not working.
A view:
...
Advice
1
vote
1
replies
60
views
How to use csrf-csrf with Express and cookie based sessions in Node.js
I’m building a Node.js web app using Express, Nunjucks as the templating engine and cookie-session library for storing user sessions in cookies. I’d like to use the ...
-1
votes
2
answers
138
views
How to set cookies from the backend on production? [closed]
I am trying to set cookies from the backend but the frontend (browser) keeps auto deleting them. This only happens on production not on localhost.
The cookie flow is this:
user clicks login with ...
0
votes
1
answer
54
views
AWS S3 pre-signed URL upload is returning 200 OK but the file never appeared in the bucket
Using Node.js and Express.js, I am generating an AWS S3 pre-signed upload URL.The request to S3 returns 200 OK but the uploaded file file never appeared in the bucket.
There is no error in AWS console....
Advice
1
vote
3
replies
75
views
CS degree project on computer networks
I am preparing a project for a computer networks course and I wanted to ask for advice. My teacher gave me this assignment for the exam: make an analysis on the vulnerabilities and attacks to protect ...
3
votes
1
answer
102
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 ...
1
vote
0
answers
52
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 ...
Advice
0
votes
1
replies
43
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 ...
1
vote
1
answer
57
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
113
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
227
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
90
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 ...
1
vote
0
answers
56
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
1
answer
112
views
I am having an issue with TypeScript and express-jwt
This is TypeScript code that I wrote a couple of years ago:
...
-4
votes
1
answer
53
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
65
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
178
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 ...
Best practices
1
vote
3
replies
78
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 ...
1
vote
1
answer
126
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 ...
3
votes
1
answer
66
views
2
votes
0
answers
96
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
62
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
108
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
...
0
votes
2
answers
106
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 ...