package sihl

  1. Overview
  2. Docs
The modular functional web framework

Install

Dune Dependency

Authors

Maintainers

Sources

sihl-queue-0.1.8.tbz
sha256=e77ffae26dac04e446ff07854de68a03edfd05031b5cb0dbcb6dc4a96e2d1c8e
sha512=7682c55136dbb8c68517ccd2c157a3556d966cb8565d15cf21ab270f92ea7e9ee5d3ac1479ba2e34a80f3052ca5dd1a74e964a8764c2164e3e71e9048fcdf51b

doc/sihl.core/Sihl_core/App/index.html

Module Sihl_core.AppSource

A module to create Sihl apps.

Sourcetype t

An app is a thin convenience layer on top of the service container. It provides hooks that are executed at different stages in the app lifecycle.

Sourceval empty : t

empty returns an app without any services.

Sourceval with_services : Container.Service.t list -> t -> t

with_services services app adds services to an app.

Sourceval before_start : (Ctx.t -> unit Lwt.t) -> t -> t

before_start f app registers a callback f with app. The callback is executed before any service is started. This means you must not use any services here!

Sourceval after_start : (Ctx.t -> unit Lwt.t) -> t -> t

after_start f app registers a callback f with app. The callback is executed after all services are started. You can safely use services here.

Sourceval before_stop : (Ctx.t -> unit Lwt.t) -> t -> t

before_stop f app registers a callback f with app. The callback is executed before all services are stopped. You can safely use services here.

Sourceval after_stop : (Ctx.t -> unit Lwt.t) -> t -> t

after_stop f app registers a callback f with app. The callback is executed before after services are stopped. This means you must not use any services here!

Sourceval run : ?commands:Command.t list -> ?log_reporter:(unit -> Logs.reporter) -> ?args:string list -> t -> unit

run ?commands ?log_reporter app is the main entry point to a Sihl app and starts the command line interface with commands merged with the commands provided by services.

An optional log_reporter can be provided to change the logging behavior. The default log reporter logs to stdout.

Sourceval run' : ?commands:Command.t list -> ?log_reporter:(unit -> Logs.reporter) -> ?args:string list -> t -> unit Lwt.t

run' ?commands ?log_reporter app is analogous to run. It is a helper to be used in tests that need Lwt.t.

OCaml

Innovation. Community. Security.