Skip to content

Instantly share code, notes, and snippets.

@CoreyKaylor
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CoreyKaylor/9558825 to your computer and use it in GitHub Desktop.
Save CoreyKaylor/9558825 to your computer and use it in GitHub Desktop.
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