Category "express"

Mongoose and MongoDB - Get all countries and users associated with country

So I have a list of posts data that looks like this: [ {user: 'Bob', country: 'USA'} {user: 'Kim', country: 'Mexico'} {user: 'Darren', country: 'Mexico'}

How to assign ROLES in _user DB for Cloudant

How do I add Roles to users in the Cloudant user database?(_users) I have not been able to sort this out using Google or Cloudant Docs. I see some mention of a

Node.js x React x Auth0 - getting error 500 with docker-compose deployment

I'm creating a WebApp that has a React front end whose build is served by a node.js back end. There is some security implementation using Auth0 token validation

Should we build Mongoose queries on the frontend or backend?

We can build complex queries with Mongoose with options like $lte, $gt, $ne and so on... but I'm wondering where/how we should build those queries? If I have a

Property 'authorization' does not exist on type 'Request'

Consider this code: setContext(async (req, { headers }) => { const token = await getToken(config.resources.gatewayApi.scopes) const completeHeader

Node/Express I can't get the header set up in my route

I have a backend that uses Node and the Express framework and a frontend in React. The code is in Typescript. My backend uses the elastic search client to fetch

Is there a way to cast a string of only hh:mm to Date in Javascript

I have a business hours object in a mongoose schema that represent a date. I'm passing a json object and retrieving the to parse to Date as string. I wonder if

How to change port using fetch and request react js?

This is the code I took from my professor's tutorial. LoginComp is just {username: '', password: ''} const request = new Request("/users/login", { method: "

TypeError: User.generateAuthToken is not a function

userSchema.methods.generateAuthToken = async function() { const user = this const token = jwt.sign({_id:user._id.toString()},'thisisnewcourse') ret

How do I handle res.download(pathname) on frontend(ReactJS)

I have written a code on my server(NodeJS) that will send a .csv file to the frontend with express res.download(path). I would like to know how I can handle the

Why the Azure Event Hub get events so slow?

Event Hub is fast to send but slow to get. I use next code: subscribe(cb: (event: any) => Promise<void>) { this.consumerClient.subscribe(

How to get value from db.any() promise in pg-promise?

I use pg-promise and i tried to make a request to database in user model to get an array of all users like this: exports.getAllUsers = function () { let

How to solve AWS Elastic Beanstalk 504 Timeout Error?

I am using AWS Elastic Beanstalk for hosting Express/Node.js API server. It's working well with just normal APIs but I am getting this 504 Timeout error with on

Client-side jwt token storage

I need advice, what is the best way to store a JWT token? Should we store in cookies or storages? But with the CSRF flaw and xss attacks I have a doubt. I'm sti

While deploy the MERN Stack at DigitalOcean error TextEncoder is not defined

My app works on development but gives Text Encoder error in production. When I run the Node index.js command, I get the error "TextEncoder is not defined". Erro

How do i solve this node.js error when im calling it with jQuery?

I have this assignment and I'm a bit stuck. When I press the button on the site the console I get this error: GET http://localhost:3000/getUser 404 (Not Found)

Is there a way to avoid stringValue Favicon.ico error in express js

I am trying to build an application in my Express and anytime i navigate to the admin page i get this error const castError = new CastError();

Getting "Cannot set headers after they are sent to the client" error in Express [closed]

Screenshot of the error: Code of client side: jwt attached api: Here's the jwt verifying function: const authHeader = req.headers?.auth

KoaJs cant handle POST requests on CloudFunctions

I have a NodeJS Application written in KoaJS, app.ts const app = new Koa(); app.use(healthCheck()); app.use(bodyParser()); app.use(errorHandler()); app.use(end

How to do multiple (simultaneous) versions of APIs with OpenAPI and express-openapi?

Re: https://www.npmjs.com/package/express-openapi#getting-started On many projects I've been worked on (in other technologies) we would always support multiple