Skip to content

Instantly share code, notes, and snippets.

@DevEarley
Last active April 22, 2018 02:22
Show Gist options
  • Save DevEarley/d817b05b9c7e0f899607272f0a5ff222 to your computer and use it in GitHub Desktop.
Save DevEarley/d817b05b9c7e0f899607272f0a5ff222 to your computer and use it in GitHub Desktop.
Nancy bootstrapper with a default web folder
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
using Nancy.Conventions;
using Nancy.Session;
namespace SomeApi
{
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
CookieBasedSessions.Enable(pipelines);
}
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/", "App_Data/Web"));
base.ConfigureConventions(nancyConventions);
}
}
}
/*
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*"/>
</httpHandlers>
</system.web>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment