-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
is the Dynamic Modules Example flawed? #2731
Comments
Of course! Let me move this issue to the appropriate repo since it seems that's something we should rather improve in the docs |
What's the proper approach for submitting revisions to this doc without offending the original contributor, open an issue first or create a PR for comments? I'm finding Dynamic Modules writing style very roundabout and that makes it difficult to read compared to the rest of the documentation. There are wordy paragraphs of the structure "Question ... effectively ... in other words":
That could be much more direct:
Other examples to make it read more concisely like Wikipedia:
|
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I would like to provide feedback on this example, I am not very experienced with NestJS, so I am part of the target public.
I think the dynamic module example seems somehow flawed.
This seems more like a particular way to configure a module, but it is not dynamic.
We use dependency injection to be able to replace, modules, or to have multiple implementations, etc. Kind of a Plugin architecture.
A dynamic module should, in fact, return different set of components depending on something dynamic.
For example, will the service store in SQL database or in an Redis server, with different services / providers being instantiated as result.
Being able to configure a module and passing the configuration to the constructor is something well covered by the ConfigModule, isn't it? The provided example allows configuration at the time in which the module is included into another, which is a valuable alternative.
However, changing the structure of the application, by bringing in a dynamic set of components seems more like the responsibility of DynamicModule, that is why the register method returns a module, so that components can be altered dynamically.
I managed to implement this setup following the documentation, however, I find a problem.
DynamicModule.register method will need to take decisions before deciding the structure of the module to return.
Which tools can be used to take those decisions? Could I inject other modules to the register method in order to take those decisions? I
It would be helpful if the example covers the patterns that can take place in the DynamicModule.register method.
Describe the solution you'd like
An example that creates a module dynamically, involving different set of components brought to context.
The example should cover patters to decide at the register method.
Teachability, documentation, adoption, migration strategy
Users will be able to extract the full potential of the NestJS architecture.
What is the motivation / use case for changing the behavior?
I don't think a change of behavior is required, but rather to show what it is possible.
The text was updated successfully, but these errors were encountered: