Functional Handlers
With this module, requests can be handled in a functional manner, reducingthe boilerplate code to be written by a web application developer.
ℹ️
Apps can quickly be created by using aproject template.
Hosting an API
To host an API using this framework you can create anInline
handler and addyour operations as needed.
using GenHTTP.Engine.Internal;using GenHTTP.Modules.Functional;using GenHTTP.Modules.Layouting;var bookService = Inline.Create()// GET http://localhost:8080/books/?page=1&pageSize=20 .Get((int page,int pageSize) =>/* ... */)// GET http://localhost:8080/books/4711 .Get(":id", (int id) =>/* ... */)// PUT http://localhost:8080/books/ .Put((Book book) =>/* ... */)// POST http://localhost:8080/books/ .Post((Book book) =>/* ... */)// DELETE http://localhost:8080/books/4711 .Delete(":id", (int id) =>/* ... */);var api = Layout.Create() .Add("books", bookService);await Host.Create() .Handler(api) .Development() .Console() .RunAsync();
Further Resources
The following capabilities are shared by various application frameworks: