/Fable.Giraffe

Giraffe for Fable.Python

Primary LanguageF#Apache License 2.0Apache-2.0

Fable.Giraffe

Build and Test Nuget

Giraffe is a high performance, functional ASP.NET Core micro web framework for building rich web applications.

Fable.Giraffe is a port of the Giraffe F# library to Fable and Fable.Python. I.e Fable.Giraffe is written in F# and runs on Python.

Example

let webApp =
    route "/ping" |> HttpHandler.text "pong"

let app =
    WebHostBuilder()
        .ConfigureLogging(fun builder -> builder.SetMinimumLevel(LogLevel.Debug))
        .UseStructlog()
        .Configure(fun app -> app.UseGiraffe(webApp))
        .Build()

Build

To build Fable.Giraffe, run:

> poetry install
> dotnet run Build

Building Fable.Giraffe for development purposes may require the very latest Fable compiler. You can build against the latest version of Fable by running e.g:

> dotnet run --project ..\..\..\Fable\src\Fable.Cli --lang Python

Remember to build fable library first if needed e.g run in Fable directory:

> dotnet fsi build.fsx library-py

Running

To run the test server:

> dotnet run App

Note that Fable.Giraffe is a valid ASGI application so you can start the server manually using servers like uvicorn:

> poetry run uvicorn program:app  --port "8080" --workers 20

Testing

> dotnet run Test