createServerfunction which prepares underneath a basic application context with default set of bounded dependencies, like, eg. Logger.
ContextReaderinterface, which in other words means that the registered function should be able to read from the bootstrapped server context. Knowing the basics, let's create some readers!
GET /request, you should see in the
Hello, world!message in the response. Thats how Dependency Injection work in Marble.js!
EffectContextwhich holds i.a. the context provider (ask) and the contextual client instance (in case of HTTP module it will be a running HttpServer).
Dependency2Token, we can also grab the dependency inferred type. Reading from the context is not a safe operation, thus the provided dependency is wrapped around Option monad that you can work on. As you can see the real benefit of using Readers is to be able to provide that context in an implicit way without the need to state it explicitly on each one of the functions that needs it.
useContextutility functions that save a lot of unnecessary boilerplate. Let's redefine the previous example.
bindEagerlyTofunction. It means that the registered dependency will try to resolve its dependencies on server startup.