-
-
Save akimboyko/5235074 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using Autofac; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.Bootstrappers.Autofac; | |
using Nancy.Hosting.Self; | |
using Nancy.Routing; | |
public class Bootstrapper : AutofacNancyBootstrapper | |
{ | |
protected override IEnumerable<ModuleRegistration> Modules | |
{ | |
get | |
{ | |
return new [] { | |
new ModuleRegistration(typeof(IndexModule), typeof(IndexModule).FullName) | |
}; | |
} | |
} | |
protected override NancyInternalConfiguration InternalConfiguration | |
{ | |
get | |
{ | |
return NancyInternalConfiguration.WithOverrides(x => x.RouteDescriptionProvider = typeof(Foo)); | |
} | |
} | |
} | |
public class IndexModule : NancyModule | |
{ | |
public IndexModule() | |
{ | |
Get["/"] = x => { | |
return "Nancy running on ScriptCS!"; | |
}; | |
} | |
} | |
public class Foo : IRouteDescriptionProvider | |
{ | |
public string GetDescription(INancyModule module, string path) | |
{ | |
return string.Empty; | |
} | |
} | |
NancyBootstrapperLocator.Bootstrapper = new Bootstrapper(); | |
var nancyHost = new NancyHost(new Uri("http://localhost:1234/nancy/")); | |
nancyHost.Start(); | |
Console.WriteLine("Nancy is running at ..."); | |
Console.ReadKey(); | |
nancyHost.Stop(); |
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
<packages> | |
<package id="Nancy" version="0.16.1" targetFramework="net40" /> | |
<package id="Nancy.Hosting.Self" version="0.16.1" targetFramework="net40" /> | |
<package id="Nancy.Bootstrappers.Autofac" version="0.16.1" targetFramework="net40" /> | |
<package id="Autofac" version="2.6.3.862" targetFramework="net40" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment