Questions tagged [saturn-framework]

Saturn is an F# Web framework that takes its design inspiration from Elixir's Phoenix framework, but is built on top of F#'s Giraffe library for ASP.NET Core.

20 questions
8
votes
3 answers

How to get a query parameter in F# Saturn Framework?

Say we have this web server to handle requests: let webApp = scope { get "/api/zoo/animals/" (getAllAnimals()) getf "/api/zoo/animals/%s" getAnimalInfo } This syntax is described in docs and demoed in the example. Now, what if I want…
psfinaki
  • 1,814
  • 15
  • 29
4
votes
1 answer

How to properly force HTTPS in SAFE-Stack?

As per Saturn docs, to have HSTS in Saturn, one needs to specify force_ssl in the application: application { url ("http://0.0.0.0:" + port.ToString() + "/") force_ssl ... } This works for the deployed version of the web, however it…
psfinaki
  • 1,814
  • 15
  • 29
4
votes
1 answer

How to convert a sequence of Task to a sequence of MyType

So I currently have a sequence of type seq> and I want to turn it into a sequence of type seq. I'm currently using TaskBuilder.fs library and from my research, I need to use either let! or do! for…
Danson
  • 415
  • 1
  • 7
  • 16
3
votes
1 answer

How to access and use user secrets in a saturn application

Edit: here are some adaptions to the answer by Koenig Lear,in case someone else stumbles upon this question: to add user secrets to the application i used this code, where the ID used by config.AddUserSecrets is the secrets id that gets added to the…
kMutagene
  • 177
  • 10
3
votes
0 answers

Using the Saturn Framework, how can I get a reference to the Websockets hub outside of a particular request?

I'm building an application for a toy problem to learn more about SAFE. I have some background processes running server-side and occasionally they need to send a message unprompted to the connected clients. This means that I need a reference to the…
3
votes
1 answer

Saturn API not responding to GET when using acceptJson

The F# Saturn web framework fails on retrieving a value for GET method when acceptJson is a part of pipeline. Below a sample code that I run to reproduce the issue: let api = pipeline { plug acceptJson set_header "x-pipeline-type"…
PiotrWolkowski
  • 8,408
  • 6
  • 48
  • 68
3
votes
1 answer

How to build integrations tests for a Saturn app

I'm trying to build some integration tests for a small API I've built using the Saturn framework. The API is built with the usual Saturn computation expressions such as application, controller, router etc. But in order to build integration tests I…
Simon Lomax
  • 8,714
  • 8
  • 42
  • 75
3
votes
1 answer

Enabling CORS using F# and ASP.NET

How do I enable CORS using F# and ASP.NET. I'm trying to authenticate a user with Google but I get the following error in the browser console: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin…
sashang
  • 11,704
  • 6
  • 44
  • 58
3
votes
1 answer

How to change log level in F# Saturn Framework?

When I run my Saturn app, I see some logs being written to the console. Looks like they start with the LogLevel.Info. How do I engage more detailed logging, i.e. how to properly set e.g. LogLevel.Trace?
psfinaki
  • 1,814
  • 15
  • 29
2
votes
2 answers

SAFE-stack with github authorization

I am trying to hide my whole application behind a authentication (I'll deal with authorization when this works), and for now I want to every url to require github login. I am not getting the github login page up. I have tried to combine the…
Espen Brun
  • 103
  • 7
2
votes
0 answers

How does one use windows authentication with a saturn or giraffe app?

I am very new to Saturn and Giraffe. I am trying to configure a saturn web app to use windows authentication for an intranet app - ultimately I want to run it with IIS. In the old world of asp.net it is trivial but in the saturn(giraffe(asp.net…
boggy
  • 3,674
  • 3
  • 33
  • 56
1
vote
1 answer

Saturn Router - same function for getf and get?

should be simple question but I can't find the API docs that detail how to do this. I have a controller function like this let loadScreen (ctx: HttpContext) (number: int) : HttpHandler = htmlString "etc" And a router that defines two routes that…
Josh
  • 186
  • 1
  • 3
  • 17
1
vote
1 answer

Saturn Value restriction error when module is in separate file

When I move UiRoutes module into a separate file it gives me an error when compiling. This is the first time using Saturn and Giraffe so I'm not sure what is happening? What is the difference having the module in a separate file? The error I get…
Chilli
  • 33
  • 7
1
vote
1 answer

Process.start being used to launch browser but is now deprecated

If I go through the "How to start" guide for Saturn: https://saturnframework.org/tutorials/how-to-start.html when I run the last step: dotnet fake build -t run the webserver does indeed appear to start. I can go to http://localhost:8085/books and…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
1
vote
0 answers

.NET SDK requirement for Saturn

When following the "How to start" guide for Saturn: https://saturnframework.org/tutorials/how-to-start.html Step 4 says to run: dotnet tool restore Here's the result of running that on my system: PS…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
1
2