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)
<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!
startWebServer
defaultConfig
(fun ctx ->
async {
let path = ctx.request.path
printfn "path: %s" path
let body =
ctx.request.rawForm
|> System.Text.Encoding.UTF8.GetString
let responseBody =
sprintf "my response to: %s" body
|> System.Text.Encoding.UTF8.GetBytes
let response =
{ status =
{ code = int HttpStatusCode.OK
reason = "resource found" }
headers = []
content = HttpContent.Bytes responseBody
writePreamble = false }
return Some { ctx with response = response }
})
writePreamble
do?