using System; using System.Collections.Generic; using System.Threading.Tasks; using Nancy.Bootstrapper; using Nancy.Owin; using Owin; namespace NzbDrone.Owin.MiddleWare { public class NancyMiddleWare : IOwinMiddleWare { private readonly INancyBootstrapper _nancyBootstrapper; public NancyMiddleWare(INancyBootstrapper nancyBootstrapper) { _nancyBootstrapper = nancyBootstrapper; } public void Attach(IAppBuilder appBuilder) { var nancyOwinHost = new NancyOwinHost(null, _nancyBootstrapper); appBuilder.Use((Func, Task>, Func, Task>>)(next => (Func, Task>)nancyOwinHost.Invoke), new object[0]); } } }