asp.net core 5.0,怎么山寨了koa2?

5.0提出了一个中间件的概念。实现思想跟koa一样。

app.Use(async (context, next) =>
        {
            // Do work that doesn't write to the Response.
            await next.Invoke();
            // Do logging or other work that doesn't write to the Response.
        });

        app.Run(async context =>
        {
            await context.Response.WriteAsync("Hello from 2nd delegate.");
        });

  

原文地址:https://www.cnblogs.com/maoyan/p/14681292.html