We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Ian Russell • 5 years ago

A couple of potential improvements:
1. You can use match! instead of let! and match:
match! featureManager.IsEnabledAsync("customGreeting") with
| true -> return! ctx.WriteTextAsync "Hello Jonathan, how are you?"
| false -> return! ctx.WriteTextAsync"Hello, how are you?"

2. I like to split the routes out to make them more readable:
let featuresRoutes : HttpHandler =
subRoute "/features"
(choose [
GET >=> choose [
route "" >=> getFeatureResponse
]
])

let webApp: HttpHandler =
choose [
route "/" >=> text "Welcome to my API"
featuresRoutes
]
Nice post!

Jonathan Channon • 5 years ago

Thanks for the tips!