Questions tagged [suave]

A lightweight, non-blocking web server for F#

Suave is a lightweight, non-blocking web server. The non-blocking I/O model is efficient and suitable for building fast, scalable network applications. In fact, Suave is written in a completely non-blocking fashion throughout. Suave runs on Linux, OS X and Windows flawlessly.

112 questions
1
vote
0 answers

streaming data from events to a Suave socket

I am experimenting with Suave to send a stream of data updates; I want to replace a system we have that does polling with a socket implementation. Here's some code: let updateStreamSocket (webSocket : WebSocket) (context: HttpContext) = socket…
Thomas
  • 10,933
  • 14
  • 65
  • 136
1
vote
1 answer

return position in an async block, in F#

I have the following code: let private SendOk (payload: 'a) : WebPart = payload |> Json.serialize |> OK >=> Writers.setMimeType "application/json" let getBTCBalance (addresses: string list) : Async = async { try …
Thomas
  • 10,933
  • 14
  • 65
  • 136
1
vote
1 answer

how to set up Suave to access a post message on any route, and binding to "*"

I need to set up a service that need to accept POST messages to ANY route on that IP and have the web server listening to ALL IPs the machine has I can make a list of local IPs easily, add 127.0.0.1 to it for testing. How can I set up a callback on…
Thomas
  • 10,933
  • 14
  • 65
  • 136
1
vote
1 answer

How to create a new Record Type using existing Record Type?

I am trying to create a simple Todo REST API using Suave. The Todo type is defined as: type Todo = { id: Guid title: string isComplete: bool deadline: DateTime option } This type works perfectly when using Get By Id GET…
Harshal Patil
  • 17,838
  • 14
  • 60
  • 126
1
vote
1 answer

Suave project with Ionide

I'm trying to create a Suave project via Ionide, but it only gives me these options: classlib, console, saturn, expecto. What should I do to Suave appears to me?
Yuri Costa
  • 199
  • 9
1
vote
0 answers

How to fix F# error FS0193: FSharp.Core does not contain ValLinkagePartialKey (F#)?

I am doing the F# SuaveMusicStore tutorial of theimowski and ran into the following error: error FS0193: The module/namespace 'Control' from compilation unit 'FSharp.Core' did not contain the val 'ValLinkagePartialKey(OnSuccess)' It seems to come…
1
vote
1 answer

Custom dynamic response with Suave?

I want to build a simple counter with Suave. [] let main argv = let mutable counter = 0; let app = choose [ GET >=> choose [ path "/" >=> OK "Hello, world. "; path…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
1
vote
1 answer

Suave "Hello World!" program doesn't work with visual studio for Mac

I got runtime errors trying to execute the "Hello World!" program from Suave web page: open Suave.Web open Suave.Successful [] let main argv = startWebServer defaultConfig (OK "Hello, Suave!") 0 With this errors: Loaded…
javicabanas
  • 457
  • 4
  • 4
1
vote
1 answer

Handling Binary (excel) file in Multi-data Post data in Suave.IO

I am trying to build a simple Suave.IO application to centralize the sending of emails. Currently the application has one endpoint that takes subject, body, recipients, attachments, and sender as form data and turns them into an EWS email message…
shanglun
  • 73
  • 9
1
vote
1 answer

How enable compression for a JSON REST call in Suave?

I want to know how return JSON for my REST calls compressed: GET /orders HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate But the docs only talk about returning files let setJson it = it |>JsonUtils.toJson |> OK >=> setMimeType…
mamcx
  • 15,916
  • 26
  • 101
  • 189
1
vote
0 answers

How streaming a large json in Suave?

I have a query that could return a large JSON in suave: let queryCustomers(term, sorted:string) = use db = DbClient.openConn() let sort = sorted |> Customers.strToSorted CustomerDb.querySearch(db, term, sort) |>JsonUtils.toJson The…
mamcx
  • 15,916
  • 26
  • 101
  • 189
1
vote
2 answers

Streaming string data with F# Suave

With Suave 2.4.0 supporting TransferEncoding.chunked and HttpOutput.writeChunk I have written the below code to stream out data over HTTP. let sendStrings getStringsFromProducer : WebPart = Writers.setStatus HTTP_200 >=> …
airmanx86
  • 992
  • 1
  • 8
  • 16
1
vote
1 answer

How to stop routing with an error

I'm writing a Suave app and I want to stop if the origin ip is not in the authorized list for the route. For this I've written a small filter: let RemoteIp (ipList: System.Net.IPAddress List) (x: Http.HttpContext) = if (ipList |> List.map (fun…
team-rf
  • 241
  • 1
  • 7
1
vote
1 answer

Add Suave - Open Declarations not working

I add Suave.io to my project - so far empty - via NuGet and that's alright. But none of the open Suave declarations work yielding "The namespace or module "Suave" is not defined." The following works in script file though: #r ".../Suave.dll" open…
Sasha Babaei
  • 455
  • 3
  • 8
1
vote
1 answer

Can't publish a dummy F# Suave app as an Azure WebApp. What am I doing wrong?

The project was generated through Ionide and Visual Studio Code. I'm deploying to an Azure WebApp through GitHub. The GitHub repository is: https://github.com/laygr/suave-dummy The activity log says: Command: build.cmd The system cannot find the…
Lay González
  • 2,901
  • 21
  • 41