Below is an official example for registering routes in Nancy . But what if I don't want to "do something" in this method, but instead do it in DoSomething()?
public class ProductsModule : NancyModule
{
public ProductsModule()
{
Get["/products/{id}"] = _ =>
{
};
}
}
public abstract class NancyModule : INancyModule, IHideObjectMembers
{
public RouteBuilder Get { get; }
}
public class RouteBuilder : IHideObjectMembers
{
public RouteBuilder(string method, NancyModule parentModule);
public Func<dynamic, dynamic> this[string path] { set; }
}
I do not know what signature DoSomethingshould have. Could this work something like below? It's not that I should not use a lambda expression; I'm just curious, because all of these Nancy models use a look rather strange and unique.
public class ProductsModule : NancyModule
{
???? DoSomething(????)
{
return ????
}
public ProductsModule()
{
Get["/products/{id}"] = DoSomething;
}
}
source
share