Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const username = req.body.username;
- const password = req.body.password;
- if (!username) {
- throw new Error('Missing username');
- }
- if (!password) {
- throw new Error('Missing password');
- }
- User.findOne({ username, password }).then(user => {
- res.json({ user });
- }).catch(err => {
- res.json({ err });
- });
- const username = req.body.username;
- const password = req.body.password;
- if (!username) {
- res.json({ err: 'Missing username' });
- }
- if (!password) {
- res.json({ err: 'Missing password' });
- }
- User.findOne({ username, password }).then(user => {
- res.json({ user });
- }).catch(err => {
- res.json({ err });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement