Skip to content

Instantly share code, notes, and snippets.

@gerardtoconnor
Last active July 13, 2017 01:40
Show Gist options
  • Save gerardtoconnor/1c2bc955dfed6518e072f0eff2853c54 to your computer and use it in GitHub Desktop.
Save gerardtoconnor/1c2bc955dfed6518e072f0eff2853c54 to your computer and use it in GitHub Desktop.
Example Middleware next format
type GiraffeMiddleware (next : RequestDelegate,
handler : HttpHandler,
loggerFactory : ILoggerFactory) =
member __.Invoke (ctx : HttpContext) =
task {
let finalNext = (fun ctx -> task { Some ctx } )
let! result = handler finalNext ctx
if (result.IsNone) then
return! next.Invoke ctx
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment