Options for WebAPI with F#

Greetings,

I’m new to F# and I thought about using it for my new project for a simple WebAPI. Any thoughts on the pros and cons of the available options such as Giraffe, Suave, or the default ASP.NET Core MVC? I have a C#/VB background but mostly for Console Apps if that would make a difference in choosing any of those options. I’d appreciate any pointers to do further reading on those too. Thanks.

Hello, i created a sample repo to show this differcene in my company, i started with simple aspnetcore webapi because for them is easier coming from C#. you might find this useful, it’s the exact same API, one running in C#, the other in F#.

there is also reading appsettings.Local.json per environment (configured on Local in F# so you need to add the env var in the project properties)

and it shows the benefit of type providers both in the Data layer and ApiClient level!

hope this is useful to you as well:

as a second step i will try to add also a Giraffe sample to compare with the default .net template

I’ll definitely check this out. I’m actually in the middle of exploring Giraffe right now just because I found more materials on it compared to everything else, but it will help to compare the two from vanilla .NET Core webapi. Thanks for your help.

There is Saturn (layer on top of giraffe), Falco and WebSharper too. I don’t know if Freya is still maintained. Here is an article which suggests using vanilla for simple APIs and moving to giraffe when you want to do more. I’m looking at the moment and am leaning towards Giraffe or Falco.

https://dev.to/jhewlett/dependency-injection-in-f-web-apis-4h2o

Heard about Saturn, but not Falco and WebSharper. Right now, I’m still trying to understand the pros and cons (why should I use this, not that for my case and is it still actively maintained). Freya was mentioned in a few F# videos from Microsoft but that was from 2018 and unfortunately, the website no longer works! :frowning: