package sihl
Install
Dune Dependency
Authors
Maintainers
Sources
md5=efe50e8f7c33f76810c6312f13a54a2a
sha512=6f3a6a6abbcce2d3569e83cfd564ed9a964efa7665956cb355b3ff85d0ce6eb80eba8ae9876d71c5e2f0ce070933e7233117c356601387dbaeccd5778a5cb289
doc/sihl/Sihl/Web/index.html
Module Sihl.Web
Source
HTTP method
A handler
returns a response given a request.
A router
has a scope, a list of routes and a list of middlewares. A mounted router prefixes all routes and applies the middlewares to them.
get path ?middlewares handler
returns a router with a single GET
route containing the handler
. The scope of the router is path
.
head path ?middlewares handler
returns a router with a single HEAD
route containing the handler
. The scope of the router is path
.
options path ?middlewares handler
returns a router with a single OPTIONS
route containing the handler
. The scope of the router is path
.
post path ?middlewares handler
returns a router with a single POST
route containing the handler
. The scope of the router is path
.
put path ?middlewares handler
returns a router with a single PUT
route containing the handler
. The scope of the router is path
.
patch path ?middlewares handler
returns a router with a single PATCH
route containing the handler
. The scope of the router is path
.
delete path ?middlewares handler
returns a router with a single DELETE
route containing the handler
. The scope of the router is path
.
any path ?middlewares handler
returns a router with a single route containing the handler
. The scope of the router is path
. This route matches any HTTP method.
routes_of_router router
applies the middlewares, routes and the scope of a router
and returns a list of routes.
choose ?scope ?middlewares routers
returns a router by combining a list of routers
.
scope
is the new scope under which all routers
are mounted.
middlewares
is an optional list of middlewares that are applied for all routers
. By default, this list is empty.
routers
is the list of routers to combine.
externalize_path ?prefix path
returns a path with a prefix
added.
If no prefix
is provided, PREFIX_PATH
is used. If PREFIX_PATH
is not provided, the returned path equals the provided path.
This module simplifies dealing with HTMX requests by adding type safe helpers to manipulate HTMX headers. Visit https://htmx.org/reference/ for the HTMX documentation.