Category "express"

TypeORM bulk insert?

How do i bulk insert multiple records in 1 query so my db will be efficient I want to create Office and insert multiple new equipments into that office. Table/m

Ambiguos "Error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type" error in nexus graphql

I'm getting the following error when using nexus to define a graphql schema with apollo-server. Error: NEXUS__UNKNOWN__TYPE was already defined and imported as

TypeError: authJwt is not a function

I am doing an e-shop project using MERN stack in that I faced the above error app.js: const express = require("express"); const app = express(); const morgan

Express not catching exception in middleware

I'm attempting to use middleware to catch exceptions in routes. Expected Result: When an error is thrown in a route I expect it to be caught by the middleware

Docker Redis Error: connect ECONNREFUSED 127.0.0.1:6379

I'm following a tutorial from youtube creating a simple dockerized CRUD application in Express, Node.js, Mongo & Redis. I stucked at video 3:06:57 on Authen

why sequelize beforeUpdate hook doesn't work?

I have a simple user model with 2 hooks. User.beforeCreate(setSaltAndPass) User.beforeUpdate(setSaltAndPass) the first works perfectly but the beforeUpdate doe

Ask for credentials before showing my swagger

I'm trying to add security to my API swagger endpont. I have created my API using node.js and express and swagger-ui-express module. The problem is that anyone

Session Data is not updating

I m using express-session and memcached-connect package for maintaining session. Everything is working as expected. Here is my implementation: Middleware app

create-react-app shows an error of "You need to enable JavaScript to run this app."

I use express for my API. I have a folder named app and another folder named server. app is the client app, using create-react-app as boilerplate, while server

How does this function that takes in a RequestHandler in express work?

I was browsing through some code examples for Express server on GitHub and came across this function used to wrap around REST API controllers and was confused h

How to return id of uploaded file (upload with multer in nodejs express app)

I have an MEAN stack app and trying to upload file with multer. Upload is working fine the only problem is I want to return uploaded file's id. //multer setti

How to generate a refresh token?

I am implementing JWT in one of my node apps. I am wondering, if there is any definite format/ structure in which a refresh token should be generated? By de

Creating single instance or multiple instance of service layer in nodejs

I want to know what should I use to expose my service layer for nodejs api What are the pros and cons of using the approach 1 and 2. app.post("/", (req, res) =&

Using axios.post, response.data return html instead of data [Nodejs, React]

What I want is, when I click SUBMIT button, it should post some data using axios.post const sb = async () => { axios.post('/tagSearch',{ qual: qual

MongoParseError: URI does not have hostname, domain name and tld

I'm getting this error when I try to connect my app(nodejs) to mongodb. I really appreciate your help here. MongoParseError: URI does not have hostname, domain

Moment.js startOf is returning end of day

I am passing in the following date through query string: 2020-09-23 I am trying to figure out why the below code with the doesn't work comment above it is not w

Not able to add more than 1 post request in the mongo db

i am using mongo db to fetch and post the data but unable to post more than 1 request here is my code ON posting the different values second time i am getting t

How to make 301 redirect in NextJS Vercel project?

How can I make 301 re directions from one url to another in NextJS application that is stored on Vercel? I tried to add custom express server using server.js fi

How can i get specific error messages from a Mongoose Schema?

I am trying to set up user validation in Mongoose and struggling to get the specific messages to appear. Here is my model const userSchema = new Schema({ n

Appending a Prefix to Routes in One File in Express JS

I am currently refactoring my code and I am hoping there is a more efficient way to make my code look pretty. Here is what I currently have: router.route('/ap