package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-0.1.2.tbz
sha256=69705a3a35f204acfdda62f61056e3f0ec3ef5bcd1df1508be65b066a0b1df9c
sha512=1987d211f56d0261eefbae978065a4e6781d60ad94b08597875307e5cf6e5a1b79787d9c79f784f5a9f77c35203cfd0b488841a07adfd87b0710d6fd65422b94
doc/sihl.app/App/index.html
Module App
Source
A Sihl app is something that can be started and stopped and that users can interact with through HTTP or CLI commands. It contains configuration, HTTP endpoints, a list of services, schedules and CLI commands.
Kernel services
An app requires a minimal set of services. That set is called kernel services. Kernel service implementations are provided by Sihl, so you don't need any external dependencies to get started with Sihl apps.
App creation
After implementing domain services which makes an app that solves a particular problem, you want to expose it to users by creating a Sihl app.
Once you have set up the kernel services, use the functor Sihl.App.Make
to instantiate an app like follows:
module KernelServices = struct
module Random = Sihl.Utils.Random.Service.Make ()
module Log = Sihl.Log.Service.Make ()
module Config = Sihl.Config.Service.Make ()
module Db = Sihl.Data.Db.Service.Make ()
module MigrationRepo = Sihl.Data.Migration.Service.Repo.MakeMariaDb (Db)
module Cmd = Sihl.Cmd.Service.Make ()
module Migration = Sihl.Data.Migration.Service.Make (Log) (Cmd) (Db) (MigrationRepo)
module WebServer = Sihl.Web.Server.Service.Make (Log) (Cmd)
module Schedule = Sihl.Schedule.Service.Make (Log)
end
module App = Sihl.App.Make (KernelServices)
Usage
An app can be set up using a clean builder pattern. Make sure to call run
in the end:
let services = ...
let endpoints = ...
let config = ...
let schedules = ...
let commands = ...
let () =
App.(
empty
|> with_services services
|> with_endpoints endpoints
|> with_config config
|> with_schedules schedules
|> with_commands commands
|> run)
module Sig : sig ... end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page