Provide a plugin-like hooks for Marble.js applications
See original GitHub issueProblem statement: Consider an example to build utility to print all the API effects/routes at the time of starting a server. This problem cannot be solved by middlewares. Also, Marble.js provides no hooks/events to let application developer know about the state of the server.
Solution
Similar to how we have ErrorEffect
, provide one more type of effect for common events. These server effects would be streams like other effects. They will be used by an application developer to handle the required scenarios.
Current alternative
Since there is no abstraction on top of createServer
, it leaves the code organization to the application developer. The developer will manually add callbacks or listen for various server events.
Notes: If we consider Marble.js as a framework, then it makes sense to provide developers with these hooks as framework essentially implies Inversion of Control (IOC). If the scope of Marble.js is more confined an express-like or a library-like feature-set, then it probably doesn’t make sense.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top GitHub Comments
Right now Marble.js is trying to reside between library and framework, but if we want to extend the tooling and available features in order to have more coherent place, we should definitely treat it more as a fully featured framework.
Yes, this kind of initialization process is something that we need introduce, but in version 2. Because we want to add a support for web sockets, this thing is required. Without an additional abstraction level, the Marble environment will be too diffused.
@krzysztof-miemiec BTW.
@marblejs/cli
is a cool idea 🤔@mflorence99 Did you have any luck generating a
swagger.yml
in yourmarblejs
apps? Any tips you could share here?