Category "express"

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

Authentication between different applications through sessions (React + Express)?

I'm developing a React + Express website and I'm in doubt on how to implement the login functionality since it depends on another application. Let me explain it

Passing variables to the next middleware using next() in Express.js

I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable is a given as 'undefined'"

Express middleware - add promise rejection handlers

I have the following simplified middleware function: router.put('/', function (req, res, next) { const data = req.body; const q = req.parsedFilterParam;

nodejs terminates on redis failure

I am using Node.js, Express, Redis and Socket.io. When Redis is down, Node.js will terminate. How can I prevent this, probably somewhere to code reconnection o

express route parameters keeps loading

I can see the dynamic id that appears on the URL but the page keeps loading... I have attached the route that HTML redirects us to and the database. // Route Pa

Getting error "Converting circular structure to JSON" while working with express,mongodb

I'm trying to find tours within a specific distance.here is my code exports.getTourWithin = catchAsync(async (req, res, next) => { const { distance, latlng

Handling multiple requests without previous one blocking the next one

I have problems trying to handle multiple requests from the client. By right, each route should be handled asynchronously, however I can't make handling request

Handling multiple requests without previous one blocking the next one

I have problems trying to handle multiple requests from the client. By right, each route should be handled asynchronously, however I can't make handling request

multer file upload - how to get a value from multer in route?

I'm uploading a file using multer with Express. I'd like access a value from multer's storage object inside the route. How can I do that? Multer configuration (

Req.Params.Token returns undefined

In my code, I have my registration page send out a verification email once the form is filled out and submitted. They receive the link to their email to verify

Node.js get image from web and encode with base64

I'm trying to fetch an image from the web and encode it with base64. what i have so far is basically: var request = require('request'); var BufferList = requi

What is NODE_ENV and how to use it in Express?

This is my app that I'm currently running on production. var app = express(); app.set('views',settings.c.WEB_PATH + '/public/templates'); app.set('view engine',

jwt.verify not throwing error for expired tokens

I'm using JWT - jsonwebtokens in Nodejs. I'm creating a token and want to throw an error if the token expires. My token is created successfully and I'm checking

JSON.parse() Returning Unexpected end of input

[`const express = require('express'); const app = express(); const https = require('https'); const url = "https://api.thevirustracker.com/free-api?countryTimeli

StripeInvalidRequestError: You can only create new accounts if you've signed up for Connect

When trying to test Stripe Connect Api, I get the following error: 'StripeInvalidRequestError: You can only create new accounts if you've signed up for Connect

req.cookies returns undefined but cookies are set

I am using cookie-parser in my express app. When the root page is requested I set a random number on the cookie using res.cookie(name, value) and it sets it fin

Cannot get external images in NextJS with Custom server Express

I'm developing NextJS app with custom server by ExpressJS, and the app cannot show external image, code example: export function DocumentSection({content}) {

req.flash() not working after req.session.destroy()

Based on a condition, I need to destroy user's current session, and redirect him to a login page with a message. I use flash to have a show-once-only message. E

Use specific middleware in Express for all paths except a specific one

I am using the Express framework in node.js with some middleware functions: var app = express.createServer(options); app.use(User.checkUser); I can use the .