Creates a singleton middleware that creates an instance of an object and stores it in the context. If the instance already exists in the context, it will return the existing instance.
Options for the singleton middleware.
A tuple containing the middleware function and a function to get the singleton instance from the context.
Creates a singleton middleware that creates an instance of an object and stores it in the context. If the instance already exists in the context, it will return the existing instance.