NancyFxViaAspNetCore
1.0.0
โครงการเทมเพลต ASP.NET Core 3.1 ที่ใช้การกำหนดเส้นทาง NANCYFX 1.4.4 แทน MVC ปกติ
ฉันจะชอบเส้นทางใน Nancyfx ก่อน v1.4.4:
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 และ Enter