Module Jerboa

module Meth : sig ... end

Jerboa.Meth contains only the type definition of a Http method.

Jerboa.Cookie module only contain the type definition of a cokkie and a constructor.

module Header : sig ... end

Jerboa.Header module consists of the type definition of header and also functions working on this type.

module Request : sig ... end

Jerboa.request module consists of the type definition of the Request record.

module Response : sig ... end

Jerboa.request module contains the type definition of the Request record and a constructor for the Response.

module Path : sig ... end

Jerboa.Path contains the type definition of the Path record and also a variety of constructors.

module Request_handler : sig ... end

Jerboa.Request_handler contains only the type definnition of a request handler.

module Path_mapping : sig ... end

Jerboa.Path_mapping has the type definition of the path mapping.

module Path_handler : sig ... end

Jerboa.Path_handler module consists of the type definition of the Path_handler and an easy to use constructor.

val default_request_handler : 'a -> Response.t

Jerboa.default_request_handler is the default request handler that will be run when no matching path is found by Jerboa. It gives back a http 404 response with an empty body.

val start : ?⁠port:int -> ?⁠default_request_handler:(Request.t -> Response.t) -> ?⁠middleware_config:(Request.t -> Request.t) Base.List.t -> Path_handler.t Base.List.t -> unit

Jerboa.start ?port ?default_request_handler ?middleware_config path_handler_config is the starting point of Jerboa, which starts the framework.

  • port(optional): gives the port of the running framework (default is 8080)
  • default_request_handler(optional): request handler, which will be run if Jerboa can't find matching path_handler (default is default_request_handler)
  • middleware_config(optional): list of middlewares that transforms the request before the matching handler is found (default is empty list)
  • path_handler_config: list of path handlers that will be matched by jerboa based on the request