-
Notifications
You must be signed in to change notification settings - Fork 6
User Guide
joongonn edited this page Dec 8, 2015
·
4 revisions
The following diagram illustrates how the client application interfaces with the library.

- The user defines a RouteTable, mapping URL path patterns to their handlers
- Which the Backend uses to determine where to send a request
The RouteTable is basically a table of function pointers into the application space's class methods. It is constructed with a list of Endpoint instances:
public sealed class RouteTable : IEnumerable<Endpoint>
{
......
public RouteTable(params Endpoint[] endpoints) { ...The Endpoint is defined as:
public class Endpoint
{
public readonly Method Method;
public readonly Route Route;
public readonly Func<Request, Task<HttpResponse>> Handler;
public Endpoint(Method method, Route route, Func<Request, Task<HttpResponse>> handler)
{
Method = method;
Route = route;
Handler = handler;
}
}And a Route may be constructed with a pathTemplate pattern:
public sealed class Route
{
...
public Route(string pathTemplate) {The following pattern forms are currently supported:
- Literal match
/accounts
- Path variable capture
/products/{id}/transactions
- Trailing wildcard
/files/*