Skip to content

Node task3#10

Open
mandeepduggal wants to merge 3 commits intomasterfrom
NodeTask3
Open

Node task3#10
mandeepduggal wants to merge 3 commits intomasterfrom
NodeTask3

Conversation

@mandeepduggal
Copy link
Owner

No description provided.

res.setHeader('content-type', 'application/json');
let uname = req.cookies["username"];
let data = userdb.filter((e) => e.uname === uname)
console.log(data[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove statement

let data = userdb.filter((e) => e.uname === uname)
console.log(data[0])

return (data.length > 0) ? res.status(200).send({ "status": "ok", "userDetail": { "id": data[0].id, "email": data[0].email, "uname": data[0].uname } }) : res.status(400).send({ "status": "invalid" });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify the return statement

next();
} else {
console.log("authenticate");
// res.status(302).header({ Location: '/' }).send({ "status": "please login first" });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

}
} catch (ex) {
console.log("validate");
// res.status(302).header({ Location: '/' }).send({ "status": "please login with correct login details first" });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console statements and commented code

Copy link
Collaborator

@vishal8885 vishal8885 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console statements and commented code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants