Skip to content

Commit

Permalink
Fix: circular dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Heromyth committed Nov 6, 2020
1 parent d95ff6e commit 901cbe3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
13 changes: 0 additions & 13 deletions source/hunt/framework/controller/Controller.d
Original file line number Diff line number Diff line change
Expand Up @@ -1033,16 +1033,3 @@ void callHandler(T, string method)(RoutingContext context)
context.end();
}

RoutingHandler getRouteHandler(string str)
{
return _actions.get(str, null);
}

void registerRouteHandler(string str, RoutingHandler method)
{
// key: app.controller.Index.IndexController.showString
version (HUNT_FM_DEBUG) logDebug("Add route handler: ", str);
_actions[str.toLower] = method;
}

__gshared RoutingHandler[string] _actions;
2 changes: 1 addition & 1 deletion source/hunt/framework/provider/HttpServiceProvider.d
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module hunt.framework.provider.HttpServiceProvider;

import hunt.framework.controller.Controller;
import hunt.framework.config.ApplicationConfig;
import hunt.framework.config.ConfigManager;
import hunt.framework.http.HttpErrorResponseHandler;
import hunt.http.routing.handler.DefaultErrorResponseHandler;
import hunt.framework.Init;
import hunt.framework.provider.ServiceProvider;
import hunt.framework.routing;
Expand Down
20 changes: 20 additions & 0 deletions source/hunt/framework/routing/RouterHandler.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module hunt.framework.routing.RouterHandler;

import hunt.http.routing.RoutingContext;

import std.string;


RoutingHandler getRouteHandler(string str)
{
return _actions.get(str, null);
}

void registerRouteHandler(string str, RoutingHandler method)
{
// key: app.controller.Index.IndexController.showString
version (HUNT_FM_DEBUG) logDebug("Add route handler: ", str);
_actions[str.toLower] = method;
}

__gshared RoutingHandler[string] _actions;
3 changes: 2 additions & 1 deletion source/hunt/framework/routing/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ public import hunt.framework.routing.RouteItem;
public import hunt.framework.routing.ResourceRouteItem;
public import hunt.framework.routing.RouteGroup;
public import hunt.framework.routing.RouteConfigManager;
public import hunt.framework.routing.RouterContex;
public import hunt.framework.routing.RouterContex;
public import hunt.framework.routing.RouterHandler;

0 comments on commit 901cbe3

Please sign in to comment.