FSharp.FIO.Http 0.2.2-beta

This is a prerelease version of FSharp.FIO.Http.
dotnet add package FSharp.FIO.Http --version 0.2.2-beta
                    
NuGet\Install-Package FSharp.FIO.Http -Version 0.2.2-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.FIO.Http" Version="0.2.2-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FSharp.FIO.Http" Version="0.2.2-beta" />
                    
Directory.Packages.props
<PackageReference Include="FSharp.FIO.Http" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FSharp.FIO.Http --version 0.2.2-beta
                    
#r "nuget: FSharp.FIO.Http, 0.2.2-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FSharp.FIO.Http@0.2.2-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FSharp.FIO.Http&version=0.2.2-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FSharp.FIO.Http&version=0.2.2-beta&prerelease
                    
Install as a Cake Tool

FIO.Http

NuGet Run Tests License: MIT

HTTP server for FIO, built on Kestrel. Routes and handlers are plain values you compose, so an endpoint is a description you build up and hand to the server — errors surface as a typed HttpError, never raw exceptions.

  • Composable routes — build a routing table with get / post and the ++ operator
  • Functional handlersHttpRequest -> FIO<HttpResponse, HttpError>, with JSON and text helpers
  • Middleware — attach cross-cutting behavior with @@ (e.g. Middleware.before)
  • Path & query parameters — typed access to request data

Install

dotnet add package FSharp.FIO.Http

Quick Start

open FIO.Http
open FIO.Http.SimpleRoutes
open FIO.Http.RoutesOperators

let routes =
    get "/" (HttpHandler.text "Hello!")
    ++ get "/json" (HttpHandler.okJson {| msg = "Hello" |})

Server.runServer ServerConfig.defaultConfig routes

Handlers & middleware

open FIO.Http.MiddlewareOperators

// Read the 'n' query parameter and return its square, validating the input.
let squareHandler request =
    match Map.tryFind "n" request.QueryParams with
    | Some(value :: _) ->
        match Int32.TryParse value with
        | true, n -> FIO.succeed (Response.okJson {| input = n; square = n * n |})
        | _       -> FIO.succeed (Response.badRequestText "Query parameter 'n' must be an integer.")
    | _ -> FIO.succeed (Response.badRequestText "Missing query parameter 'n'.")

// Middleware that logs each incoming request.
let logging =
    Middleware.before (fun request ->
        FIO.attempt (fun () -> printfn $"{request.Method} {request.Path}") id)

let routes =
    get "/" (HttpHandler.text "Hello!")
    ++ get "/square" squareHandler

Server.runServer ServerConfig.defaultConfig (routes @@ logging)

Errors

Operations fail with a typed HttpErrorInvalidRoute, ParsingFailed, HandlerFailed, MiddlewareFailed, ServerFailed, BodyReadFailed, JsonFailed, TimeoutError, GeneralError — with HttpError.fromException / HttpError.toException to bridge raw exceptions.

Examples · FIO core · MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.2-beta 64 7/12/2026
0.2.1-beta 64 7/9/2026
0.2.0-beta 62 7/6/2026
0.1.15-alpha 66 6/30/2026
0.1.10-alpha 63 6/24/2026
0.1.0-alpha 81 6/18/2026