Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
F# FubuMVC Endpoints Hypothetical
module CustomerEndpoints
let ``GET /customers/list`` (repository: ICustomerRepository) =
repository.List
|> Seq.map customerToViewRecord
type GetCustomerInput = {Id: int;}
let ``GET /customers/{Id}`` (repository: ICustomerRepository) (input: GetCustomerInput) =
repository.Get input.Id |> customerToViewRecord
type EditCustomerInput = {Id: int; FirstName: string; LastName: string;}
let ``POST /customers/{Id}/edit`` (repository: ICustomerRepository) (input: EditCustomerInput) =
input |> toCustomer |> repository.Save |> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment