can’t connect to localhost after setup cookies-parser node.js express
I tried to make registration system in my application using cookie-parser, express and jwt tokens, after i done with my code, start application and tried to connets at localhost, it dosn’t donwload anything, this is error that i got
also this is my cookie-parser version from package.json “cookie-parser”: “^1.4.5”,
this is how i use cookies-parser in router.post when user login
const accessToken = createToken(user)
res.cookie("token",accessToken,{
maxAge:60*60*24*30*1000
})
this is jwt
const createToken = (user) =>{
const accessToken = sign({login: user.login, isAdmin:user.idAdmin,id:user.id},"jwt-secret")
return accessToken
}
const validateToken = (req,res,next) =>{
const accessToken = req.cookies["token"]
if(accessToken){
try {
const validtoken = verify(accessToken,"jwt-secret")
if(validateToken){
req.authenticated = true
return next()
}
} catch(err){
console.log(err)
}
}
}
also that is what i see in browser console
rbug/1173575, non-JS module files deprecated.
Read more here: Source link