Skip to content

Instantly share code, notes, and snippets.

@jsancho
Created June 12, 2018 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsancho/b5fe40be2de30a837ac4865c10d7ecfa to your computer and use it in GitHub Desktop.
Save jsancho/b5fe40be2de30a837ac4865c10d7ecfa to your computer and use it in GitHub Desktop.
[FunctionName("SwaggeredFunction")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post",
Route = "SwaggeredFunction/{name}")]
HttpRequestMessage req,
string name,
TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
return string.IsNullOrWhiteSpace(name)
? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a valid value as part of the path ")
: req.CreateResponse(HttpStatusCode.OK, $"Hello {name}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment