Skip to content
F#+ bindings for core. This is intended to enable development of web api:s leveraging F#+ and core.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


F#+ bindings for core. This is intended to enable development of web api:s leveraging F#+ and core.


MacOS/Linux Windows
Travis Badge Build status
Build History Build History


Stable Prerelease
NuGet Badge NuGet Badge


Make sure the following requirements are installed in your system:

PM> dotnet build

Getting Started

PM> mkdir MySite
PM> dotnet new console -lang f# -o MySite
PM> dotnet add ./MySite package FSharpPlus.AspNetCore
PM> dotnet add ./MySite package FSharpPlus.AspNetCore.Suave

You can then add your code in the style of Suave

// Learn more about F# at

open System

open FSharpPlus

open FSharpPlus.AspNetCore
open FSharpPlus.AspNetCore.Suave
open HttpAdapter
open Successful
open RequestErrors
open Filters
open Writers

open Microsoft.AspNetCore
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.Builder

open Newtonsoft.Json

module Json=
  let inline OK v=
    OK (JsonConvert.SerializeObject v)
    >=> setContentType "application/json; charset=utf-8"
  let inline CREATED v=
    CREATED (JsonConvert.SerializeObject v)
    >=> setContentType "application/json; charset=utf-8"

type Todo = { id:int; text:string }
type IDb =
  abstract member AddTodo: string -> Async<Todo>
  abstract member GetTodo: int ->Async<Todo option>

let myWebPart(db:IDb) =
  let register =
      POST >=> hasFormContentType >=> fun ctx -> monad {
      match ctx.request |> Request.Form.tryGet "text" with
      | Some text ->
        let! todo = lift (db.AddTodo (string text))
        return! Json.CREATED todo ctx
      | None ->
        return! BAD_REQUEST "Could not find form text" ctx
  let getTodo id=
      GET >=> fun ctx -> monad {
        match! lift (db.GetTodo id) with
        | Some todo ->     
          return! Json.CREATED todo ctx
        | None ->
          return! NOT_FOUND "Could not find todo" ctx
  WebPart.choose [ 
                  path "/" >=> (OK "/")
                  path "/todo" >=> register
                  pathScan "/todo/%d" getTodo

type CmdArgs =
  { Json : string option }
let main argv =
  let buildWebHost args =
      .Configure(fun (app: IApplicationBuilder)->
        let db = { new IDb with
                   member this.AddTodo(text)=failwith "not implemented" 
                   member this.GetTodo(id)=failwith "not implemented" 
        let webPart = myWebPart db
            |> appMap "/v1/" (Suave.appRun webPart)
            |> ignore


If you are looking for a composable library for web then Suave and Giraffe are the ones mostly used. Giraffe should have better performance than this library. Suave has been around the longest (it inspired Giraffe). For a simple web framework you have also Frank.

You can’t perform that action at this time.