Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Route types

Fernando Escolar edited this page May 6, 2021 · 1 revision

There is a record for each element defined in the HttpMethods enum:

Connect(string Pattern, RouteDelegateAsync RouteDelegate);

Delete(string Pattern, RouteDelegateAsync RouteDelegate);

Get(string Pattern, RouteDelegateAsync RouteDelegate);

Head(string Pattern, RouteDelegateAsync RouteDelegate);

Options(string Pattern, RouteDelegateAsync RouteDelegate);

Patch(string Pattern, RouteDelegateAsync RouteDelegate);

Post(string Pattern, RouteDelegateAsync RouteDelegate);

Put(string Pattern, RouteDelegateAsync RouteDelegate);

Trace(string Pattern, RouteDelegateAsync RouteDelegate);

If you want to use them, you just have to create an object that inherits from one of these records, specify the pattern and declare the delegate.

The delegate is a function that returns a Task (async function) with a HttpRequest and a HttpResponse as parameters:

Task RouteDelegateAsync(HttpRequest req, HttpResponse res);
Clone this wiki locally