Module type Rest.CONTROLLER
A module of type CONTROLLER
can be used to create a resource with resource_of_controller
. Use a controller instead of a service and a view if you need low level control.
val index : string -> Rock.Request.t -> Rock.Response.t Lwt.t
index name request
returns a list of all resource instances as a response.name
is the name of the resource in plural, for exampleorders
orusers
.
val new' : ?key:string -> string -> Rock.Request.t -> Rock.Response.t Lwt.t
new' ?key name request
returns a form to create instances of the resource as a response.name
is the name of the resource in plural, for exampleorders
orusers
.The form data is stored in the flash storage under the
key
. By default, the value is_form
.
val create : string -> ('a, 'b, t) Conformist.t -> Rock.Request.t -> Rock.Response.t Lwt.t
create name schema request
handles the creation of new resource instances and returns the creation result as a response.name
is the name of the resource in plural, for exampleorders
orusers
.
val show : string -> Rock.Request.t -> Rock.Response.t Lwt.t
show name request
returns a single resource instance as a response.name
is the name of the resource in plural, for exampleorders
orusers
.
val edit : ?key:string -> string -> Rock.Request.t -> Rock.Response.t Lwt.t
edit ?key name request
returns a form to edit resource instances as a response.name
is the name of the resource in plural, for exampleorders
orusers
.The form data is stored in the flash storage under the
key
. By default, the value is_form
.
val update : string -> ('a, 'b, t) Conformist.t -> Rock.Request.t -> Rock.Response.t Lwt.t
update name schema request
handles the update of a resource instance and returns the update result as a response.name
is the name of the resource in plural, for exampleorders
orusers
.