Skip to content

Instantly share code, notes, and snippets.

@chamook
Created April 15, 2019 12:25
Show Gist options
  • Save chamook/f1626e01695346289d5f099e3544ec31 to your computer and use it in GitHub Desktop.
Save chamook/f1626e01695346289d5f099e3544ec31 to your computer and use it in GitHub Desktop.
type Price = { ItemId: string; Price: Decimal }
let getPriceForItem itemId : HttpHandler =
match itemId with
| "1" -> { ItemId = "1"; Price = 2.00M } |> Successful.OK
| "2" -> { ItemId = "2"; Price = 4.50M } |> Successful.OK
| _ -> RequestErrors.NOT_FOUND ()
let webApp =
choose [
routef "/item/%s/price" getPriceForItem
route "/health" >=> Successful.OK "Everything's fine here, how are you?" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment