Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
ademar on master
Corrected default port from 808… Merge pull request #723 from Wa… (compare)
@ademar Thanks for the tip. I've basically only copied the code on the suave introduction page: https://suave.io/index.html
open System
open System.Threading
open Suave
[<EntryPoint>]
let main argv =
let cts = new CancellationTokenSource()
let conf = { defaultConfig with cancellationToken = cts.Token }
let listening, server = startWebServerAsync conf (Successful.OK "Hello World")
Async.Start(server, cts.Token)
printfn "Make requests now"
Console.ReadKey true |> ignore
cts.Cancel()
0 // return an integer exit code
but if I remove Console.ReadKey it becomes nonblocking.
Is the key not to use startWebServerAsync
and rather use startWebServer
as u mentioned?
<input type="hidden" id="custId" name="custId" value="3487">
let config =
{ defaultConfig with
bindings = [ HttpBinding.create HTTP IPAddress.Any (uint16 port) ]
}
Hi everyone! I'm a newbie of both f# and Suave and I'm loving them both so far!
I have a question tho, which I'm struggling to find an answer to.
Is there a way I can read the request as a stream?
Something that would allow me to do things like:
let stream = ctx.request.Stream ()
and then consuming it incrementally?
thanks a lot in advance!