Last active
March 27, 2019 18:03
-
-
Save pizycki/451471c41bcdb11ffed2ec1bc426c3ee to your computer and use it in GitHub Desktop.
NanoWebServer.fs
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
| open Suave | |
| open Argu | |
| type Args = | |
| | [<EqualsAssignment>] IP of host:string | |
| | [<EqualsAssignment>] Port of port:int | |
| with | |
| interface IArgParserTemplate with | |
| member s.Usage = | |
| match s with | |
| | IP _ -> "Address where WebAPI will be available." | |
| | Port _ -> "WebAPI port." | |
| [<EntryPoint>] | |
| let main argv = | |
| let parser = ArgumentParser.Create<Args>() | |
| let args = parser.Parse argv | |
| let host = args.GetResult IP | |
| let port = args.GetResult Port | |
| startWebServer { | |
| defaultConfig with | |
| bindings = [ HttpBinding.createSimple HTTP host port ] | |
| } (Successful.OK "Hello from NanoWebServer!") | |
| 0 |
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
| NanoWebServer.exe --ip=127.0.0.1 --port=8082 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment