Category "express"

How to sign a cookie manually using cookieParser?

For the sake of testing, I need to provide a signed cookie with HTTP request. So that, my Express app server can consider it as a signed cookie and put it into

ExpressJs is return error `ERR_MODULE_NOT_FOUND` if I import the file without `js` extension

I build a expressJs app by ES6 and I got the below error: (node:4132) ExperimentalWarning: The ESM module loader is experimental. internal/modules/run_main.js:

app.get - is there any difference between res.send vs return res.send

I am new to node and express. I have seen app.get and app.post examples using both "res.send" and "return res.send". Are these the same? var express = require

How to disable Morgan (request logger) during unit test?

I use Morgan (default express generator request logger), and I'm trying to disable it during unit testing. Currently I'm using the default configuration, which

CORS issues: The 'Access-Control-Allow-Origin' header mustn't contain multiple values

I want to allow my server to let two different domains read data without getting a CORS issue. Therefore, I wrote the following code line (in node.js): app.

Difference between req.url and req.originalUrl in Express.js version 4

I am trying to implement login feature in Express.js version 4 app. I need to determine whether an user is logged in before he can do certain actions. So I have

How do I move files in node.js?

How can I move files (like mv command shell) on node.js? Is there any method for that or should I read a file, write to a new file and remove older file?

NextJS: How to handle multiple dynamic routes at the root

Goal: I would like to achieve github style routing, where abcd in github.com/abcd could resolve to a user profile page or a team page. I currently have a v

What does "trust proxy" actually do in express.js, and do I need to use it?

I am writing an express app that sits behind an nginx server. I was reading through express's documentation and it mentioned the 'trust proxy' setting. All it

How to use Express with Vue

First time using Node js, Express and Vue. I have a pomodoro timer website made with vue (not vue-app/vue-cli) which I'm wanting to upload to Heroku. The websi

setupProxy is not working - http-proxy-middleware

My react app is up on localhost:3000 and node server is running on localhost:5000. When I am trying to connect to the express API the route is going to 'localho

Node.js + Express.js (Connect) - Accessing Session from 'upgrade' event

I'm trying to access the session object from an 'upgrade' event fired by a Node.js server using the Express.js framework. I have set up Session support correctl

How to get GET (query string) variables in Express.js on Node.js?

Can we get the variables in the query string in Node.js just like we get them in $_GET in PHP? I know that in Node.js we can get the URL in the request. Is the

router.get doesn't work but router.get with id works

calling http://localhost:5000/surveycreate/4 works and redirects me to surveypage.html but calling http://localhost:5000/surveycreate does not work, it redire

nodejs multer retrieve stored images to the client side

I have created file storage in nodejs application to store images in uploads folder. which works fine but now I want to display those images I have read some ot

How to Insert documents to multiple collection in a single query using nodejs

I am trying to insert documents into multiple collections by writing single query. Let consider that I have two collections person and address. I want insert d

express.js - best POST json schema validator [closed]

I'm searching for a module to validate POST json requests in my Express.js application. What json schema module do you use in your node.js ap

Express and nginx net::ERR_CONTENT_LENGTH_MISMATCH

I'm developing an Express-driven site, that is going through an nginx proxy. Sometimes when loading a page in the browser, I get this: GET http://myapp.local/c

Express and nginx net::ERR_CONTENT_LENGTH_MISMATCH

I'm developing an Express-driven site, that is going through an nginx proxy. Sometimes when loading a page in the browser, I get this: GET http://myapp.local/c

How to use http-auth with Sails

I have deployed my Sails app to a PaaS, and I'd like to have simple password protect so that no one can access my staging server. What's the simplest way to do