Skip to main content
The 2024 Developer Survey results are live! See the results

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
2 votes
1 answer
21 views

Typescript: Variable inside Express RequestHandler becomes possibly undefined despite being checked in an if statement

I am creating a way to dynamically create routes before the server fully starts (meaning I'm not creating a route via a request lol that would be crazy), and I stumbled upon this interesting quirk. ...
0 votes
0 answers
8 views

How to generate openapi doc in express

I'm making a REST service using javascript and express. I have some endpoints and I wanna create a swagger file to serve along with it. I'm using swagger-autogen to generate the swagger file. Even ...
349 votes
33 answers
259k views

Extend Express Request object using Typescript

I’m trying to add a property to express request object from a middleware using typescript. However I can’t figure out how to add extra properties to the object. I’d prefer to not use bracket notation ...
0 votes
0 answers
6 views

Axios Post Still Blocked Even Though "Access-Control-Allow-Origin", "*" Set On server

In my backend I've set the following endpoint router.post("/sign-in", async (req, res) => { try { //Extracting email and password from the req.body object const { email, ...
0 votes
1 answer
21 views

Ways to create a login using nodejs

So i am learning nodejs i am trying to create a login here what I made so far it works it connects to mongodb and check if the field if same then changing the allow variable to true any ways to create ...
13 votes
6 answers
14k views

Call java program from Node.js application

From what I read, there are a couple of ways to run java files in a node.js application. One way is to spawn a child process: (the java code is packaged with dependencies in an executable jar.) var ...
14 votes
8 answers
72k views

How to solve JsonWebTokenError "invalid signature" after assigning some infos to the generated token?

Have a problem when trying to verify the token (it was working fine before i added some data to it before generating it) .. but now it does not seem to be working ! This is how i generate the token ...
17 votes
5 answers
36k views

Optimize Node.js memory consumption

I'm writing a simple cms in Node.js, Express and MongoDB. I'm planning to run a different Node.js process for every site. The problem is that after startup the process takes about 90m of RAM and for ...
-2 votes
0 answers
21 views

Why res.clearCookie() is not working after deploying to vercel?

First of all, everything works fine when running on localhost. However, after deploying the app to Vercel when the user tries to log out it should clear cookies with res.clearCookie() but it doesn't ...
0 votes
0 answers
14 views

Aggregate vs Populate methods when to use one in nodejs Mongose

I am creating asset managment tool for warehouse and I have Warehouse , Asset, Category models. I want to get the overall stats of each warehouse like , total assets and how many of them is active or ...
0 votes
1 answer
16 views

express-session does not persist session by cross site request

My client/server architecture: Client (Frontend): Vue (Vite) Server (Backend): Express.js Currently i use only the http, because it's a develop enviornment. For safe request purpose handling, i use ...
1 vote
0 answers
21 views

Having trouble sending an image from Express to React client

In express, I'm using the google places api to get city images. I'm having trouble sending the response to my react client. here's my express route: router.get('/', async (req, res) => { const { ...
-1 votes
2 answers
34 views

Why does my node.js server fetch files from a different location than what's in the url?

I have two websites on my Windows Server 2022 Datacenter (a VM on AWS). I set them up in sort of an unorthodox way. The first is at http://www.planetshah.com/pwv and the other is at http://www....
0 votes
0 answers
8 views

How to handle Authentication and private routes in React-native + Node.js?

I want a good way to handle Authentication in React-Native. I was planning on using JWT tokens and make the accessToken refresh without making the user ever log-in again(assuming they have a ...
2 votes
0 answers
2k views

Change Express route path on the fly

I want to know a way to change a route path on the fly (with the application already running): var route = express.Route(); route.get('a/path/:id', callback); I want to change the route with path 'a/...

15 30 50 per page
1
2 3 4 5
6389