Skip to content
Browse files

Refactored Route Registration methods.

There is always the RegisterRoutes method which the AppActivator and test
methods call with/without bool feedOnlyMode
  • Loading branch information...
1 parent d787aae commit b2f67199948b671bb13b127248fd81abd7a36c84 @deepakaravindr deepakaravindr committed
Showing with 22 additions and 18 deletions.
  1. +1 −17 src/NuGetGallery/App_Start/AppActivator.cs
  2. +21 −1 src/NuGetGallery/App_Start/Routes.cs
View
18 src/NuGetGallery/App_Start/AppActivator.cs
@@ -170,23 +170,7 @@ private static void ElmahPreStart()
private static void AppPostStart(IAppConfiguration configuration)
{
- if (!configuration.FeedOnlyMode)
- {
- Routes.RegisterRoutes(RouteTable.Routes);
- }
- else
- {
- // The home route is used as a probe path by Azure Load Balancer
- // to determine if the node is up. So, always register the home route
- // Just do so with an Empty Home, in the FeedOnlyMode, which simply returns a 200
- RouteTable.Routes.MapRoute(
- RouteName.Home,
- "",
- new { controller = "Pages", action = "EmptyHome" });
- }
-
- Routes.RegisterApiV2Routes(RouteTable.Routes);
- Routes.RegisterServiceRoutes(RouteTable.Routes);
+ Routes.RegisterRoutes(RouteTable.Routes, configuration.FeedOnlyMode);
AreaRegistration.RegisterAllAreas();
GlobalFilters.Filters.Add(new ElmahHandleErrorAttribute() { View = "~/Views/Errors/InternalError.cshtml" });
View
22 src/NuGetGallery/App_Start/Routes.cs
@@ -7,7 +7,27 @@ namespace NuGetGallery
{
public static class Routes
{
- public static void RegisterRoutes(RouteCollection routes)
+ public static void RegisterRoutes(RouteCollection routes, bool feedOnlyMode = false)
+ {
+ if (!feedOnlyMode)
+ {
+ Routes.RegisterUIRoutes(routes);
+ }
+ else
+ {
+ // The home route is used as a probe path by Azure Load Balancer
+ // to determine if the node is up. So, always register the home route
+ // Just do so with an Empty Home, in the FeedOnlyMode, which simply returns a 200
+ RouteTable.Routes.MapRoute(
+ RouteName.Home,
+ "",
+ new { controller = "Pages", action = "EmptyHome" });
+ }
+ Routes.RegisterApiV2Routes(routes);
+ Routes.RegisterServiceRoutes(routes);
+ }
+
+ public static void RegisterUIRoutes(RouteCollection routes)
{
routes.MapRoute(
RouteName.Home,

0 comments on commit b2f6719

Please sign in to comment.
Something went wrong with that request. Please try again.