Skip to content

Instantly share code, notes, and snippets.

@embix
Created November 28, 2017 20:41
Show Gist options
  • Select an option

  • Save embix/4e3613203ec2462609968e94a1a35666 to your computer and use it in GitHub Desktop.

Select an option

Save embix/4e3613203ec2462609968e94a1a35666 to your computer and use it in GitHub Desktop.
<Query Kind="FSharpProgram">
<NuGetReference>Suave</NuGetReference>
</Query>
open System
open System.Net
open System.Threading
open Suave
[<EntryPoint>]
let main argv =
let cts = new CancellationTokenSource()
let conf = {
defaultConfig with
cancellationToken = cts.Token
bindings = [
HttpBinding.create HTTP IPAddress.Loopback 55555us
]
}
let listening, server = startWebServerAsync conf (Successful.OK "Hello World")
Async.Start(server, cts.Token)
printfn "Make requests now"
//Console.ReadKey true |> ignore
Console.ReadLine() |> ignore
cts.Cancel()
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment