Azure Function returning a list of Book objects
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
public static class BooksFunction | |
{ | |
[FunctionName("BooksFunction")] | |
public static IActionResult Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequest req, TraceWriter log) | |
{ | |
log.Info("C# HTTP trigger function processed a request."); | |
return new OkObjectResult(GetBooks()); | |
} | |
public static IEnumerable<Book> GetBooks() | |
=> new List<Book> | |
{ | |
new Book(1, "Enterprise Services with the .NET Framework", "Addison Wesley"), | |
new Book(2, "Professional C# 6 and .NET Core 1.0", "Wrox Press"), | |
new Book(3, "Professional C# 7 and .NET Core 2.0", "Wrox Press") | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment