sonarr-repo-only/NzbDrone.Api/AppHost.cs

39 lines
1.2 KiB
C#
Raw Permalink 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;
2013-01-03 01:09:13 +00:00
using Autofac;
2012-11-02 07:35:49 +00:00
using Funq;
using NzbDrone.Api.QualityProfiles;
using NzbDrone.Api.QualityType;
2012-11-02 07:35:49 +00:00
using ServiceStack.WebHost.Endpoints;
using QualityProfileService = NzbDrone.Api.QualityProfiles.QualityProfileService;
2012-11-02 07:35:49 +00:00
namespace NzbDrone.Api
2012-11-02 07:35:49 +00:00
{
public class AppHost : AppHostBase
{
2013-01-03 01:09:13 +00:00
private IContainer _container;
2013-01-03 01:09:13 +00:00
public AppHost(IContainer container) //Tell ServiceStack the name and where to find your web services
: base("NzbDrone API", typeof(QualityProfileService).Assembly)
{
2013-01-03 01:09:13 +00:00
_container = container;
}
2012-11-02 07:35:49 +00:00
public override void Configure(Container container)
{
2013-01-03 01:09:13 +00:00
container.Adapter = new AutofacIocAdapter(_container);
2012-11-02 07:35:49 +00:00
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
Routes
2012-11-04 01:39:29 +00:00
.Add<QualityProfileModel>("/qualityprofiles")
.Add<QualityProfileModel>("/qualityprofiles/{Id}")
.Add<QualityTypeModel>("/qualitytypes")
.Add<QualityTypeModel>("/qualitytypes/{Id}");
2012-11-04 01:39:29 +00:00
Bootstrapper.Initialize();
2012-11-02 07:35:49 +00:00
}
}
}