Home > OS >  Why am I getting error in this express.js code?
Why am I getting error in this express.js code?

Time:12-30

[code for app.js](h[code for authorize.jsthe error which I'm getting](https://i.stack.imgur.com/g9KrB.png)ttps://i.stack.imgur.com/Srqvp.png)

This is about page, so I was expecting to get About page in my screen when the url was http://localhost:5000/about?user=jiwan note: I'm learning mern

CodePudding user response:

You are setting the user object on the req.

Please set it on the response(If that's what you want).

Other than that, it's because jiwan should be a string.

So

if(user == 'jiwan'){
   res.user = {name:'jiwan', id: 1}
   next()
}
  • Related