Postman is not working

i have added the code you sent to me and the result is still the same `//login router
(err, req, res, next) => {
console.log(‘Body params:’, req.body);
check(“email”, “input must be email”).isEmail(),
check(“password”, “please type a valid password”).isLength({
min: 6
async (req, res) => {
let errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({
errors: errors.array()

try {
  const { email, password } = req.body;

  let user = await User.findOne({
  if (!user) {
      mssge: "account not found"

let comparepassword = await, user.password);
if (!comparepassword) {
password: “failed to compare, please try reloading”
const payload = {
const signToken = jwt.sign(payload, “mysecret”, {
expiresIn: 1160
}, function(err,token){
if(err)throw err;
return res.status(200).json({

   }catch (error) {
  return error;

This is the url to the login
Now, when going to the postman i serve the following

  1. the url above to the url input
    2.choose post ,cause of course am posting the data .
  2. choose header and type “Content-Type and value= application/json”
    4 finally choose “raw” shift by the right and choose json instead of text because is a json body work. yet this is not working . what do you suggest could be the problem.

Can you put the code into code blocks? Also, what do you mean when you say


Hi @nana-sv, your Postman setup should be correct to post a json body (the content-type header should automatically set from your body raw/json selection) - is your console.log statement writing out the req.body data? You can see this in Glitch using Tools > Logs. If it is then you know the issue is in your endpoint code after that point.

1 Like

I will try to help one more time by repeating what I said earlier. Now you’ve brought Postman into the mix. Before you do anything else watch 2 instructional videos on Postman, write 2 examples (or more) hitting two or more public APIs. At some point you say “aha, I have an idea how Postman works”.

Then add a route to your app named “echo” and focus on it responding which whatever string you send it. DO NOT have it validate anything, query stuff in a DB, run a bcrypt method or generate a jwt as you clearly don’t have those parts working yet.

Let me suggest that if you ever get this working you will not know why it will just have stopped throwing exceptions. I am not replying with the intention to be harsh but I’ve seen how complex the examples you post are and these are all very simply things to do. You’ve just mushed them all together in one project and do not seem to understand how they work.

Please take my word for it, if you had broken this into individual steps 2 months ago you would have it working by now.

I will try my best to follow up this time. Though I have it working when I read from postman article. When I read I discovered my postman setting where wrong, not actually my endpoint. I choose [post, raw, json, built header ]instead of www urlencoded and input the keys and value, immediately I did that its work. To be Frank, the idea you gave me is
the one helping up till now. but when it become to much for me to handle, I rather post for help, thank you ones again.

Sounds good. The takeaway here is not that Postman settings were “wrong” but that the ones you chose in Postman were not the ones expected by your website. So long as everyone agrees how the parameters are passed, what they are named, etc. it all works.

That’s why (as boring as it might be) I recommend playing with Postman awhile and accessing various public APIs until you get a real sense of what all the settings mean.

Have fun.

1 Like