NancyFxViaAspNetCore
1.0.0
使用NancyFX 1.4.4路由而不是常规MVC的ASP.NET Core 3.1模板项目。
我已经开始喜欢在v1.4.4之前在Nancyfx中进行路由:
public class SampleModule : Nancy . NancyModule
{
public SampleModule ( )
{
Get [ "/" ] = _ => "Hello World!" ;
Get [ "/home/" ] = _ =>
{
return View [ "Home/Index" ] ;
} ;
Get [ "/project/{name}" ] = p =>
{
return View [ "Project/" + p . name ] ;
} ;
Get [ "blog/{id}" ] = p =>
{
Blog blog = GetBlog ( p . id ) ;
return Response . AsJson ( blog ) ;
} ;
}
}但是由于NancyFX已停产,因此我决定在ASP.NET Core内实施类似的路由。
git clone https://github.com/zwcloud/NancyFxViaAspNetCore.git
cd .NancyFxViaAspNetCore
dotnet run然后在您的WebBrowser中,输入http://localhost:5000并输入。