Created
November 28, 2017 20:41
-
-
Save embix/4e3613203ec2462609968e94a1a35666 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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