webHost Builder Improvements
In previous versions, the minimalistic web host builder allowed devs to get running quickly and when needed enabled full customization via the configure custom operation. This meant that anything beyond a toy project, required a fair amount of repetitive boilerplate setup code.
To combat this, several custom operations have been added, which semantically match the relevant area (i.e., add_service for services, use_middleware for middleware). The goal is to avoid the need to engage in a full-fledged configuration, although the configure method still exists which will override all other customizations which also creates a kind backward compatibility.
In addition, many common operations have been explicitly mapped: use_static_files, use_https, use_compression etc.
An example of the new builder in action can be found in the docs or samples.
configuration Builder Added
A thin wrapper around ConfigurationBuilder exposing a clean API for reading configuration values.
open Falco.HostBuilder
[<EntryPoint>]
let main args =
let env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
let config = configuration args {
add_env
required_json "appsettings.json"
optional_json (String.Concat([|"appsettings."; env; ".json"|]))
}Utility Additions
StringUtils.stringfStringUtils.strSplitCookieCollectionReaderAuth.getClaimValueAuth.hasScope
New Request functionality
Request.getCookieRequest.tryBindCookieRequest.streamFormRequest.tryBindFormStream
New Request HttpHandler's
Request.mapCookieRequest.bindCookieRequest.ifAuthenticatedWithScope
New Request HttpHandler's for streaming multipart data
Two particular fundamental handlers have been added to the Request module, to support multipart form data streaming for large uploads which Microsoft defines large uploads as anything > 64KB.
Request.bindFormStreamRequest.bindFormStreamSecureRequest.mapFormStreamRequest.mapFormStreamSecure
New Response HttpHandler's
Handlers have been added to support binary responses, both inline and attachment. Both asynchronously buffer data into the response body.
Response.ofBinaryResponse.ofAttachment