Module Dal_node.Mockup

This module provides a mock HTTP server for selected RPCs. It responds to registered routes with mock data and fails all other requests. It is similar with the Proxy module.

type t

An instance of the mockup server.

type answer = [
  1. | `Response of string
]

Represents a possible response from a mocked-up route.

type route

A route definition.

val route : path_pattern:string -> callback:(path:string -> answer option Lwt.t) -> route

Creates a route for the mockup, containing a path_pattern pattern and a callback. The callback is provided with the path actually matched and is used to retrieve the DAL node answer for the given path.

val make : name:string -> routes:route list -> t

Creates a new mockup instance.

val run : t -> port:int -> unit

Starts the mockup server.

val stop : t -> unit

Stops the mockup server.