Skip to content

Instantly share code, notes, and snippets.

@marciol
Forked from eulerfx/app.fsx
Last active August 29, 2015 14:06
Show Gist options
  • Save marciol/680ef43ce3968b997d1a to your computer and use it in GitHub Desktop.
Save marciol/680ef43ce3968b997d1a to your computer and use it in GitHub Desktop.
#load "HyperF.fsx"
open HyperF
open Route
let service =
[
Get("/resource/:id") => fun (req,ri) -> "hello world!" |> HttpRes.plainText
Put("/resource/:id") => fun (req,ri) -> async {
do! Async.Sleep(1000)
return! HttpRes.plainText "done!" }
] |> Route.toService
let filteredService =
Filter.identity
|> Filter.andThen Filter.printBeforeAfterTag
|> Filter.toService service
Http.host "http://+:8081/" filteredService |> Async.RunSynchronously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment