-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-10) use WebActivator Start for routes
- Loading branch information
1 parent
afe894c
commit 2d95912
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Net.Http; | ||
using System.Web.Http; | ||
using System.Web.Http.Routing; | ||
using NuGet.Server; | ||
using NuGet.Server.V2; | ||
|
||
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(SimpleChocolateyServer.App_Start.NuGetODataConfig), "Start")] | ||
|
||
namespace SimpleChocolateyServer.App_Start | ||
{ | ||
public static class NuGetODataConfig | ||
{ | ||
public static void Start() | ||
{ | ||
ServiceResolver.SetServiceResolver(new DefaultServiceResolver()); | ||
|
||
var config = GlobalConfiguration.Configuration; | ||
|
||
NuGetV2WebApiEnabler.UseNuGetV2WebApiFeed(config, "ChocolateyDefault", "chocolatey", "PackagesOData"); | ||
|
||
config.Routes.MapHttpRoute( | ||
name: "NuGetDefault_ClearCache", | ||
routeTemplate: "chocolatey/clear-cache", | ||
defaults: new { controller = "PackagesOData", action = "ClearCache" }, | ||
constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) } | ||
); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters