The purpose of this ticket is to create auth routes that allow a user to signup and login in with their credentials to access portions of the website that require authentication.
Acceptance Criteria
[ ] create a user model that has the following functions:
[ ] makePublicUser: creates a user object with all columns of user table except for the hashed password
[ ] loginIn: uses fetchUserbyEmail function check if a user exists with the email passed in and uses bcrypt to check if the password is valid
[ ] register: uses a db query to insert into the users table
[ ] fetchUserByEmail: uses db query to check if email passed in exists in db
[ ] create an auth.js route that has post requests for login/sign up and a get request for a "/me" endpoint
[ ] make a post request on the ("/login") endpoint that creates a jwt for the user and uses user.login function
[ ] make a post request on the ("/register) endpoint that creates a jwt for the user and uses user.register function
[ ] use the auth.js route in the server js file
DOD
-[ ] A/C complete
-[ ] merge request made
-[ ] ticket connected to merge request
-[ ] all tests pass
The purpose of this ticket is to create auth routes that allow a user to signup and login in with their credentials to access portions of the website that require authentication.
Acceptance Criteria
DOD -[ ] A/C complete -[ ] merge request made -[ ] ticket connected to merge request -[ ] all tests pass