Last active
October 13, 2016 07:48
-
-
Save tamizhvendan/07fc54c3750d154a84ba7d6ccdb94eb6 to your computer and use it in GitHub Desktop.
HelloSuaveAzureFun
This file contains 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 Suave.Successful | |
open Suave.Operators | |
open Suave.Filters | |
let app = | |
choose [ | |
GET >=> OK "GET test" | |
POST >=> OK "POST test" | |
PUT >=> OK "PUT test" | |
DELETE >=> OK "DELETE test"] |
This file contains 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
{ | |
"disabled": false, | |
"bindings": [ | |
{ | |
"type": "httpTrigger", | |
"name": "req", | |
"methods": [ | |
"get", | |
"put", | |
"post", | |
"delete" | |
], | |
"authLevel": "anonymous", | |
"direction": "in" | |
}, | |
{ | |
"type": "http", | |
"name": "res", | |
"direction": "out" | |
} | |
] | |
} |
This file contains 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
{ | |
"frameworks": { | |
"net46": { | |
"dependencies": { | |
"Suave": "1.1.3", | |
"Suave.Azure.Functions": "0.0.9" | |
} | |
} | |
} | |
} |
This file contains 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
#load "app.fsx" | |
open App | |
open System.Net.Http | |
open Suave.Azure.Functions.Context | |
let Run (req : HttpRequestMessage, log : TraceWriter) = | |
try | |
let res = runWebPart app req |> Async.RunSynchronously | |
res | |
with | |
| ex -> | |
ex.StackTrace |> sprintf "%s" |> log.Info | |
let res = new HttpResponseMessage() | |
res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment