public ResttpComponent(AppFunc next, ResttpConfiguration config) { _next = next; Config = config; //TestRoutes(new HttpRouteResolver(Config.HttpRoutes)); }
public void Configuration(IAppBuilder app) { var config = new ResttpConfiguration(typeof(HomeController).Assembly); config.MapHttpRoutesFromAttributes(); config.HttpRoutes.AddRoutes ( "Home", "/Main", new { controller = "Home", action = "Index", httpMethod = "Get" }); config.HttpRoutes.AddRoutes ( "Home", "/{controller}/{action}", new { controller = "Home" }); config.DependencyResolver = GetResolver(); app.UseResttp(config); }
public static void UseResttp(this IAppBuilder app, ResttpConfiguration config) { if (app == null) { throw new ArgumentNullException("app"); } if (config == null) { throw new ArgumentNullException("config"); } app.Use<RoutingComponent>(new HttpRouteResolver(config.HttpRoutes)); app.Use<ControlerCreatorComponent>(config.DependencyResolver, config.ControllersAssembly); app.Use<ActionInvokerComponent>(config.Formatters, config.ContentNegotiator, config.ActionParameterBinder); }