using System;
namespace EmbedIO.Routing
{
///
/// A module that handles requests by resolving route / method pairs associated with handlers.
///
///
public class RoutingModule : RoutingModuleBase
{
///
///
/// Initializes a new instance of the class.
///
public RoutingModule(string baseRoute)
: base(baseRoute)
{
}
///
/// Associates a HTTP method and a route to a handler.
///
/// A constant representing the HTTP method
/// to associate with , or
/// if can handle all HTTP methods.
/// The used to match URL paths.
/// A callback used to handle matching contexts.
///
/// is .
/// - or -
/// is .
///
public void Add(HttpVerbs verb, RouteMatcher matcher, RouteHandlerCallback handler)
=> AddHandler(verb, matcher, handler);
///
/// Associates a HTTP method and a route to a synchronous handler.
///
/// A constant representing the HTTP method
/// to associate with , or
/// if can handle all HTTP methods.
/// The used to match URL paths.
/// A callback used to handle matching contexts.
///
/// is .
/// - or -
/// is .
///
public void Add(HttpVerbs verb, RouteMatcher matcher, SyncRouteHandlerCallback handler)
=> AddHandler(verb, matcher, handler);
///
/// Adds handlers, associating them with HTTP method / route pairs by means
/// of Route attributes.
/// See for further information.
///
/// Where to look for compatible handlers.
/// The number of handlers that were added.
/// is .
public int AddFrom(object target) => AddHandlersFrom(target);
}
}