-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project Auth API-W16 #334
base: master
Are you sure you want to change the base?
Project Auth API-W16 #334
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, code looks good 👍
"bcrypt": "^5.1.1", | ||
"bcryptjs": "^2.4.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of these is enough?
const generateAccessToken = (userId) => { | ||
return jwt.sign({ userId }, process.env.ACCESS_TOKEN_SECRET, { | ||
expiresIn: "24h", | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun that you tried out jwt!
}); | ||
|
||
//Registration Endpoint | ||
//http://localhost:9000/register | ||
app.post("/register", async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to REST naming conventions, endpoints should be named after what they return or in this case create. So this endpoint could be named /users
}); | ||
|
||
// Sign-in Endpoint | ||
app.post("/login", async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this could be called /sessions
Links
BE: https://project-auth-2zcr.onrender.com
FE: https://authentication-bmm.netlify.app/