Reputation: 810
I think I'm misunderstanding something. I come from the MVC world and is taught that Nancy Modules are Synonymous with Controllers in MVC.
When you first create a new project you get the a basic module like this:
public class IndexModule : NancyModule {
public IndexModule(){
Get["/"] = parameters => View["index", new ViewModels.IndexModel()];
}
}
Which works fine. But then i wanna create a new module and i go ahead to create this:
class HomeModule:NancyModule {
public HomeModule():base("/home"){ // i saw the "base()" trick in samples
Get["/"] = p => View["home"];
}
}
However this doesn't work. I get 404 when i access http://localhost:3579/home and the module is not triggered at all. So how does this work and am i even supposed to structure it like this?
Upvotes: 2
Views: 642
Reputation: 810
Ok nevermind i just solved it. I just needed to make the HomeModule class public.
public class HomeModule:NancyModule {
public HomeModule():base("/home"){
Get["/"] = p => View["home"];
}
}
Upvotes: 3