Functional Handlers
With this module, requests can be handled in a functional manner, reducing the boilerplate code to be written by a web application developer.
âšī¸
Apps can quickly be created by using a project template.
Hosting an API
To host an API using this framework you can create an Inline
handler and add
your operations as needed.
using GenHTTP.Engine;
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);
Host.Create()
.Handler(api)
.Development()
.Console()
.Run();
Further Resources
The following capabilities are shared by various application frameworks: