You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2024. It is now read-only.
Nancy strives to provide a Super-Duper-Happy-Path (SDHP), where all you have to do is follow their conventions, and everything will "just work." (You can also configure every aspect of it; it's only opinionated in its defaults.) One of these conventions is that the controllers inherit from NancyModule, and when they do, no further configuration is required. So, we create the Modules directory, and add HomeModule.cs, which looks like this:
namespace Dos.Modules
{
using Nancy;
public class HomeModule : NancyModule
{
public HomeModule() : base()
{
Get("/", _ => "Hello World from Nancy C#");
}
}
}
Since we'll be hosting this with Kestrel (via OWIN), we still need a Startup.cs, though its Configure() method looks a bit different:
public void Configure(IApplicationBuilder app) =>
app.UseOwin(x => x.UseNancy());
(We need to add a using statement for Nancy.Owin so that the UseNancy() method is visible.)