Questions tagged [suave]
A lightweight, non-blocking web server for F#
113
questions
0
votes
1
answer
34
views
Smooth scrolling native with nextJs
I have the big problem that I want to add a smooth scroll to my website and absolutely no solution works, neither the CSS nor anything I do. This is because I do not have activated the smooth ...
0
votes
0
answers
62
views
System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it
I'm writing an integration test for a component that does a transaction and after that, a webhook is called.
For that, I want to mock a webhook endpoint using suave so I can know if the webhook was ...
2
votes
1
answer
63
views
FSharp Suave - How to set cookies in the response?
I have a simple HTTP server configured in Suave as follows.
open System
open Suave
open Suave.Operators
open Suave.Filters
open Suave.Successful
[<EntryPoint>]
let main argv =
let ...
4
votes
1
answer
112
views
Removing key from session state
(Noting that my total experience with Suave and back-end web-development in general can be measured in days and counted on one hand)
As part of my project, whenever a user successfully signs in a ...
1
vote
0
answers
86
views
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 : ...
0
votes
1
answer
115
views
Failing to use LazyCache with Suave's WebPart
I'm trying to use LazyCache (https://github.com/alastairtree/LazyCache) to cache some API requests.
The code goes as this:
let private cache = CachingService()
let doAPIStuff some parameters : WebPart ...
0
votes
1
answer
89
views
not understanding the Suave API, always the same result is returned
Here is a test:
open System
open System.Threading
open Newtonsoft.Json
open Suave
open Suave.Logging
open Suave.Operators
open Suave.Filters
open Suave.Writers
let private configuration = {
...
0
votes
0
answers
70
views
Can I set thread priority in dotnet? (specifically interacting with Suave webserver, but it's a general question)
I have a tool that does a lot of calculations in a loop. It is creating async tasks and then run them in parallel. About 20% of the time, the CPU is maxed out.
At the same time, I have a REST api, ...
0
votes
1
answer
51
views
how to redirect from http to https with suave, in f#
How can I redirect a connection from http to https using Suave?
at https://gist.github.com/ademar/f4ddb788162dbdd9e104574e2accf07f I found this:
let redirectToSsl : WebPart =
context(fun c ->
...
0
votes
1
answer
70
views
default path issue with static files with Suave, in F#
I am not understanding the doc when it comes to serving static files.
I have a site where the backend is deployed to /app in a docker container and the front end part is deployed to /app/frontend
The ...
0
votes
0
answers
50
views
Suave runs out of sockets when receiving messages from AWS' SNS service
This is linked to question: Suave stops responding with "Socket failed to accept a client" error
When I first started to use Suave, I was taking commands from a 3rd party service pushing ...
0
votes
1
answer
92
views
Suave stops responding with "Socket failed to accept a client" error
I have an app running on AWS through ECS (as a Docker container) for which I used Suave to receive some REST commands.
The code is very primitive:
let conf =
{ defaultConfig with bindings = [ ...
0
votes
1
answer
55
views
returning a custom error with Suave, in F#
Where can I find, in the Suave docs, the way to return an http error with a message as a plain text error?
I keep looking and I just can't find my way through the docs since it's structured as bits of ...
1
vote
1
answer
36
views
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 (...
0
votes
1
answer
51
views
Form data is not correct with Suave web server
I am trying to receive a confirmation from AWS' SNS system.
It sends a message through a POST to a webserver and I'm receiving it using Suave.
When I get the message, the form field is truncated, I am ...
1
vote
1
answer
81
views
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 ...
2
votes
2
answers
153
views
MissingMethodException with Suave & Fable.Remoting
Here is a minimal sample that will reproduce the issue.
Trying to hit that endpoint, either with a Fable client or just navigating to http://127.0.0.1:8080/ITestAPI/Test causes the server to throw a ...
0
votes
1
answer
73
views
Does Suave include tools for database?
Is there built-in way to access databases in Suave?
2
votes
0
answers
121
views
Upload of large files using Suave?
I would like to upload files using Suave. I understand that small files will automatically get written to a /tmp folder, but my files are too large for that. What I would like to do is process them as ...
5
votes
1
answer
517
views
Suave with f# - How to have a rest api and websocket port in an f# chat application?
I have an f# chat application that needs rest apis exposed as well as have websockets for real time messaging. I am using Suave framework.
I have a frontend which has a "Chat" button that ...
3
votes
0
answers
83
views
Is Suave.io using a single thread for processing requests?
I know Suave.io is non-blocking but is it using single thread like Node.js? Is it similar to Kestrel as explained here - Is Kestrel using a single thread for processing requests like Node.js??
As a ...
4
votes
1
answer
100
views
WebPart for forwarding requests to another server using Suave?
I would like to create a WebPart that forwards all requests to another web server that I specify.
Usage might look like this:
let app =
choose
[
path "/" >=> OK "...
1
vote
1
answer
80
views
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 ...
0
votes
1
answer
201
views
Dynamically handling longer running concurrent jobs in F#
I'm struggling with the right approach to handle longer running requests/jobs in F#.
Requirement:
A job consists of multiple steps (which need to be performed sequentially).
A job can take several ...
1
vote
1
answer
167
views
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?
2
votes
1
answer
206
views
How to start a web server with Suave using HTTPS protocol?
I have read the Suave document but still cannot start a Suave web server using HTTPS protocol.
Can someone help me on this? It would be great if sample code is provided.
2
votes
2
answers
244
views
How do you createRef in Suave Fable?
I have a text input, and I've managed to debounce input. However, my keypress listener won't wait for text input events to flush before processing the enter key which would end edits without getting ...
1
vote
0
answers
364
views
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 '...
2
votes
2
answers
94
views
How capture a dynamic sub-path like "/COMPANY/rest..." with Suave and nest the routes?
I have several routes that must be grouped by "company", plus some that are valid for all:
/login
/logout
/demo1/customers
/demo1/products
So I try with suave:
let doReqScan action =
warbler (...
2
votes
1
answer
110
views
Composing web part continuations in Suave.IO with F#
Using Suave.IO, I have the following monolithic WebPart:
let success msg =
Successful.OK <| sprintf "Success: %s" msg
let error msg =
Successful.OK <| sprintf "Error: %s" msg
let ...
1
vote
1
answer
55
views
Custom dynamic response with Suave?
I want to build a simple counter with Suave.
[<EntryPoint>]
let main argv =
let mutable counter = 0;
let app =
choose
[
GET
>=> choose
[
...
3
votes
1
answer
73
views
How restart an async Suave server if it crash?
I have a embebed server for a mobile device that could crash sometimes. I need to always have the server alive. Now the problem is that I don't see how restart the server when it is async:
let ...
1
vote
1
answer
206
views
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
[<EntryPoint>]
let main argv =
startWebServer defaultConfig (OK "...
1
vote
1
answer
159
views
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 ...
1
vote
1
answer
98
views
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
...
1
vote
0
answers
73
views
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....
0
votes
0
answers
290
views
Error: "image 'en/FSharp.Core.resources.dll.so' not found: dlopen failed / condition `idx < t->rows' not met"
I'm unable to found why my app is crashing. I have a weird error condition `idx < t->rows' not met".
This is activated when try to execute a embebed web server (Suave):
let startServer() =
**...
4
votes
1
answer
286
views
How to handle "OPTIONS" requests in suave
I'm porting a prototype app I did using elm and python flask to use elm and a suave backend. The elm app is calling an API to load info from the site and do some other things. There does not seem to ...
1
vote
2
answers
217
views
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 =
...
3
votes
1
answer
148
views
Suave with netcoreapp2.0
I've been following this Suave tutorial:
https://legacy.gitbook.com/book/theimowski/suave-music-store/details
And in general this looks good. However, I was trying to make it work with Linux and for ...
2
votes
1
answer
83
views
How do I tell Suave not to cache a url?
I have 2 paths getting cached
Auth.loggedOn (
GET >=>
pathScan "/era/%i" (Some >> EraViewing.eraView homeFolder cn)
path "/" >=> indexView homeFolder cn
There ...
3
votes
1
answer
172
views
Suave not showing static file
So I have my server set up very simply. If the path is of the form /article/something, it should serve up the static file something.html within the folder static. For some reason, the Files.file ...
2
votes
1
answer
118
views
Mutable application context
I'm building a REST backend that requires a large collection of values to compute the answers. This collection is downloaded at boot time and then on demand but needs to be updated a few times per day....
1
vote
1
answer
41
views
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: ...
2
votes
1
answer
85
views
How to handle multiple forms on a single page using Suave.Experimental
I have to create simple page with multiple form. I decide to use Suave.Experimental for this purpose. When I click on submit button on the second form, I get the following error
Missing form field '...
3
votes
1
answer
78
views
the value or constructor 'handShakeWithSubprotocol' is not defined in websocket example
I am using .NET Core 2.0. I created an F# console app. In Program.fs I put the Suave WebSocket example code.
Everything compiles except for line 84:
path "/websocketWithSubprotocol" >=> ...
3
votes
1
answer
169
views
Sending (zip) file with Suave with the correct name
I have been researching creating a web server using Suave. Currently, I am trying to get it to send a zip file in a GET request. I have successfully made my application send a file, but the name of ...
3
votes
1
answer
209
views
how to use css with Suave web
i'm a newbie F# programming,
and now i try to make web with F# and Suave then i follow from this link
i have a problem that i cannot use css in my project (see on image)
id="box" wasn't show on ...
2
votes
1
answer
102
views
Suave and DotLiquid
edited for clarity
somehow this works:
path "/" >=> warbler (fun _ -> OK (string DateTime.Now))
but this one does not:
let txnAccA =
let sqlStr = "select JSON from Store.Txn"
let ...
2
votes
0
answers
110
views
How to deploy a Suave.IO project with Heroku
This is my first time using heroku and I'm having some troubles deploying my small Suave web app. After reviewing the docs here, I understand that I need to set up a Procfile so that heroku knows how ...