Skip to content

Instantly share code, notes, and snippets.

@atrauzzi
Last active January 4, 2016 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atrauzzi/8595555 to your computer and use it in GitHub Desktop.
Save atrauzzi/8595555 to your computer and use it in GitHub Desktop.
using Nancy;
public class IndexModule : NancyModule {
// What would be neat is if I could teach Nancy new ways of handling the right side of routes.
public IndexModule() {
Get["/"] = typeof(MyProject.Controller.Home);
// This would perhaps run a standard method found on the class after instantiating it.
Get["/user/profile"] = {typeof(MyProject.Controller.User), "some way of indicating the method to run"};
// This would run a specific method on the class after instantiating it.
// Handling code to would still be run "late" (as with lambdas) because the resolver would use my IoC.
// Only dependencies necessary for fulfilling the current request (defined in the controller) would be
// instantiated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment