Requirements:
dotnet
SDK 3.1 https://dotnet.microsoft.com/download/dotnet-core/3.1The easiest way to get started is to use the provided template:
dotnet
template with dotnet new -i Saturn.Template
mkdir SaturnSample && cd SaturnSample
dotnet new saturn -lang F#
dotnet tool restore
dotnet saturn gen Book Books id:string title:string author:string
dotnet saturn migration
forward "/books" Books.Controller.resource
) into browserRouter
in Router.fs
filedotnet fake build -t run
from the root of the solution. This will start the application in watch mode (automatic recompilation on changes) and open your browser on http://localhost:8085 which should display the index page.If you want to start from scratch with a minimal Saturn webserver:
dotnet new console -lang F#
)Saturn
NuGet Packageopen Saturn
open Giraffe
let app = application {
use_router (text "Hello World from Saturn")
}
run app
If you compile and run this application, it will unconditionally return the text regardless of the path.
From here on out you can add routers, controllers and views.
To get a better understanding of Saturn and the whole SAFE Stack you can look at the SAFE-Dojo.