-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added Zod Schema Validation and Error Handling #8
Added Zod Schema Validation and Error Handling #8
Conversation
@@ -0,0 +1,14 @@ | |||
import { Request, Response, NextFunction, Router } from 'express'; |
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.
Please move the middlewares to a commons package. Only retain the module-specific middleware in the recall api
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.
You can also use the folder structure in the packages/recall-api/module/example
to create modules.
packages/recall-api/src/express.ts
Outdated
@@ -82,7 +83,7 @@ export default async ({ app }: { app: Application }) => { | |||
* Add more versions of the api below | |||
*/ | |||
|
|||
// app.use('/api/v1'); | |||
app.use('/api/v1/users', userRoutes); |
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.
The routes are auto-registered if you use the decorators in the routing-controllers
package. You can read more here
Updated Changes: Refactor User Module and Common MiddlewaresIn addition to the previous changes, this update includes: Recent Changes
Reasoning for ChangesThese changes were made to improve code organization, reusability, and maintainability. By incorporating registration into the auth module, we've kept related functionality together. Moving common middlewares to a shared package allows for easier reuse across different parts of the application. Impact on Docker InstancesThe changes should not significantly impact the Docker setup. However, the Docker containers should be rebuilt and tested on the staging server to ensure compatibility. Testing Done
Please review these additional changes and let me know if any further modifications are needed. |
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.
Approved. You can create another PR for tests.
This PR introduces Zod schema validation and error handling to the project. This is to address issue #4.
1. Zod Schema Validation:
2: Zod Error Handling:
Changes Made
Request for Review
Please review the changes to ensure they align with our project's best practices. Specifically, I'd appreciate feedback on:
Looking forward to your feedback and suggestions for any improvements.
Thank you!