Refactored authentication and user routes: Moved validatePassword and… #25
+544
−815
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… resetPassword to authRoutes; created userRoutes and userController.
Description
What does this PR do?
This PR organizes routing of user and authentication endpoints. It ensures better file structure.
List of changes:
validatePassword
andresetPassword
routes toauthRoutes.js
and their logic toauthController.js
.userRoutes.js
and its logic inuserController.js
.testRoutes.js
app.js
file to reflect these changes by including the newuserRoutes
Type of Changes
Acceptance Criteria
userRoutes.js
anduserController.js
.validatePassword
andresetPassword
) are moved toauthRoutes.js
andauthController.js
.Update Screenshots
Before
testRoutes.js
.After
userRoutes.js
:GET /api/v1/users
PUT /api/v1/users/:id
DELETE /api/v1/users/:id
authRoutes.js
:POST /api/v1/auth/validate-password
POST /api/v1/auth/reset-password
Testing Instructions
Start the Server
npm run dev
in the terminal.Test User Routes
POST http://localhost:8000/api/v1/users
GET http://localhost:8000/api/v1/users
PUT http://localhost:8000/api/v1/users/:id
DELETE http://localhost:8000/api/v1/users/:id
Test Auth Routes
POST http://localhost:8000/api/v1/auth/validate-password
POST http://localhost:8000/api/v1/auth/reset-password
Verify
Learnings (Optional)