在Nancy 2.x中处理请求之前,我该怎么做?

问题描述 投票:0回答:1

无论模块还是路由,我都希望在每个请求中都做一些事情。如何在Nancy 2.x中完成此操作?

如果找到How to Intercept all Nancy requestsHow do I capture all requests irrespective of verb or path,但它们仅适用于Nancy 1.x,并且Documentation已过期。

nancy
1个回答
0
投票

您可以尝试这个:

 public class NewBootstrapper : DefaultNancyBootstrapper
 {
        protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
        {
            //Your code here
            base.RequestStartup(container, pipelines, context);
        }
 }
© www.soinside.com 2019 - 2024. All rights reserved.