Category "express"

ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client

I'm facing this weird issue in NodeJS when using with Passport.js, Express and Mongoose. Basically, I get an error saying "Cannot set headers after they are sen

How long is session stored in express-session on server?

I have used ExpressJS with express-session for Session Management. According to its NPM page, we can add a maxAge and cookies.expires. But, both of these manage

Get trending groups using mongodb aggregation

I have two collections, Group and GroupChat. A group has a chatroom respectively. // group.model { name: string, desc: string } // group.chat.model { group:

How to get handler route in NestJS Interceptor (For both Express and Fastify)

I am having issues trying to get a hold of the NestJS handler's route in an interceptor I am writing. For instance, if a Controller had a route as such: @Get

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError [ERR_ASSERTION]

I have the following setup in Visual Studio Code for nodejs project: Model: genre.js const Joi = require('joi'); const mongoose = require('mongoose'); const

How to order by many to many relationship in Sequelize?

I have a many to many relationship between User and Category through UserCategory as below. let user = await User.findAll({ where: { id: req.query.user

Why can't express router find my build files on AWS Elastic Beanstalk?

I know this seems like a dumb question, but I've deployed this same app to google and heroku successfully previously, but when I try to deploy to elastic beanst

error:failed to look up view "index" in views directory

local host port served an error in browser and did not load my static files. Returned an error 'Failed to lookup view "index" in views directory "C:\Users\xxxx\

Why is req.body undefined in Express?

I am creating a PUT method to update a given set of data however in my update function, req.body is undefined. controller.js async function reviewExists(req, re

Nested objects in response not logging to console

My server gets a response from another server with a document from a mongodb database with a body similar to { messageDetails: { body: "hello" }

File upload with multer refreshes React app

Update This is happening because of hot-reloading comes with Creact React App. Related issues: https://github.com/expressjs/multer/issues/566 https://github.c

Websockets token authentication using middleware and express in node.js

I use node.js, express and express-ws that is based on ws Express-ws allows to create express-like endpoints for websockets. I am looking for a solution to a

SyntaxError: Unexpected end of JSON input - why is that?

This is the code I have written using express and node.js const express = require("express"); const https = require("https"); const app = express();

How to resolve a circular dependency in nest js?

I have my app.module that imports UserModule and AuthModule. @Module({ imports: [UserModule, AuthModule], controllers: [AppController], providers: [AppSer

Cannot delete image from aws s3 bucket

I want to delete one of the images stored in the AWS S3 bucket by express.js, but I am facing an issue. Below is the code I have written const imageurl=req.user

Ubuntu where to see console.logs

So I am putting my app on a server and I want to see some console logs generated from my nodejs app. Before putting it on the server I saw the output of my cons

Error: secretOrPrivateKey must have a value

I am using jwt to create token, but when i login via postman I get the error "Error: secretOrPrivateKey must have a value" from my console. I have attached my l

How to use Knex object in other file?

How do I use the knex db object inside other files? For Example my index.js const app = require("express")(); const cors = require("cors"); const bodyParser

The method FB.getLoginStatus can no longer be called from http pages

So I tried to implement Facebook Login feature in my nodejs backend server. For testing purpose, I am trying client side to check the login and get access token

How do I extend the typings of Express.Application to give typings for app.locals

In our application, we're adding quite a few config objects to app.locals that get used in our middleware. const app = Express(); app.locals = { someConfig: