-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor: improve global architecture #54
base: main
Are you sure you want to change the base?
Conversation
This PR introduces a modular architecture, organized by functional domains. This is the actual structure that i'm going to follow:
Each
Wdyt on this approach ? |
… the module (index.route) - This allows autoload to work correctly (i guess), as it depends on the parent directory name. Also, we'll only have one route file, so the directory isn't needed.
|
I think having a |
@jean-michelet You mean to much for the auth module or for all modules ? yeah for auth module just an index file would do the work. However i think for other modules like tasks, we can create multiple controller files per action area. |
Are you sure it will not break ts inference? One file by controller function is too much I think. |
What do you mean by ts inference ?
It's not really one file by controller function but one file by action area. And the same thing for services i think. |
|
||
const authRoutes: FastifyPluginAsyncTypebox = async (fastify) => { | ||
const authController = createAuthController(fastify) | ||
fastify.post('', {}, authController.login) |
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.
This is an antipattern. You are splitting the route code from its definitions, and you shouldn't really do that at all, as they are tightly coupled together.
npm run test
andnpm run benchmark
and the Code of conduct
#52