Category "express"

Jest did not exit one second after the test run has completed using express

I'm using JEST for unit testing my express routes. While running the yarn test all my test case are getting passed, but I'm getting an error Jest did not exi

How to default to returning errors as JSON instead of HTML with express?

Express by default returns errors as HTML pages. As I'm developing a REST api, I want all my errors to be in JSON format. How can i configure express for this?

body-parser deprecated undefined extended: provide extended option

body-parser deprecated Why is bodyParser no longer required and what are the alternatives besides: app.use(express.urlencoded({ extended: true }));

Nextjs- api routes , How to remove a cookie from header?

I have two API routes which I want to set two cookies in /api/login.js and remove them in /api/logout.js. so this is my login API: import { serialize } from '

login with email or phone or username in node js

How can I login email or phone or username with password in node js and mongodb? user can login with email and password, username and password, phone and passwo

Sequelize Migrate Not Recognising Dotenv

I am able to run migrate command when I specify the database name, user and password directly. But when I provide with env variable/value. It says no database s

passport-jwt in MEAN-Stack returning Internal Server Error 500

Im using passport.js JWT strategy to authenticate my MEAN-Stack app. The unsecured routes work properly but i cant get the secured routes to work. they allways

grammar & spell checking in nodejs

How to check spelling mistakes, grammar & punctuation errors, use of greetings & short keywords and total time to complete each single chat session in s

How to use Mailgun variable in email template?

I am using Mailgun API with nodejs+express to send emails. I want to transition into using templates instead of writing the whole email as the HTML tag in nodej

createReadStream is not present in uploaded image

I am using node v14.17.0,"apollo-server-express": "^2.25.0", "graphql-upload": "^12.0.0" I am trying to upload an image but i dont get createReadStream from the

How to format and validate email node js

I would like that email had format like: [email protected]. Which is the best way to do it? I have a component for registration and I have the field like this: <mat-f

Express res.download()

I don't know why it's happening, but it's really annoying. I expected the file to be downloaded according to the express docs. I have the next code: //in rea

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\