Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit b2f67199948b671bb13b127248fd81abd7a36c84 1 parent d787aae
@deepakaravindr deepakaravindr authored
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,
Please sign in to comment.
Something went wrong with that request. Please try again.