This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const User = require("../models/User"); | |
const bcrypt = require('bcrypt'); | |
const jwtAuth = require('../utils/jwtAuth'); | |
function loginUser (req, res){ | |
User.findOne({ | |
email: req.body.email | |
}) | |
.exec((err, user) => { | |
if (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jwt = require("jsonwebtoken"); | |
const User = require("../models/User"); | |
function createToken (id, secret) { | |
return jwt.sign({ | |
userId: id | |
}, | |
secret, { | |
expiresIn: "72h" | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 1, b = 3 ,c = 4 , d = 5; | |
var a = 1, | |
b = 3, | |
c = 5; | |
var a = 1 | |
,b = 3 | |
,c = 5; |
NewerOlder