Lidarr/NzbDrone.Api/AppHost.cs

34 lines
1011 B
C#
Raw Normal View History

2012-11-02 07:35:49 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using Funq;
using Ninject;
using NzbDrone.Api.QualityProfiles;
using ServiceStack.ContainerAdapter.Ninject;
2012-11-02 07:35:49 +00:00
using ServiceStack.WebHost.Endpoints;
namespace NzbDrone.Api
2012-11-02 07:35:49 +00:00
{
public class AppHost : AppHostBase
{
private IKernel _kernel;
public AppHost(IKernel kernel) //Tell ServiceStack the name and where to find your web services
: base("NzbDrone API", typeof(QualityProfileService).Assembly)
{
_kernel = kernel;
}
2012-11-02 07:35:49 +00:00
public override void Configure(Container container)
{
container.Adapter = new NinjectContainerAdapter(_kernel);
2012-11-02 07:35:49 +00:00
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
Routes
.Add<QualityProfileRequest>("{ApiKey}/qualityprofiles")
.Add<QualityProfileRequest>("{ApiKey}/qualityprofiles/{Id}");
}
}
}