Difference between application and module pipelines in Nancy?

1.3k views Asked by At

I have seen in the documentation of Nancy, sometimes these two are referred distinctively.

And also is there a difference in the Before/After hooks of these two pipelines?

1

There are 1 answers

0
khellang On BEST ANSWER

The module- and application pipelines are explained in detail in the wiki.

It's basically hooks which are executed before and after route execution on a global (application pipelines) and per-module basis. Here's an example:

If a route is resolved to a module called FooModule, the pipelines will be invoked as follows:

  • Application Before Pipeline
  • FooModule Before Pipeline
  • FooModule Route Handler
  • FooModule After Pipeline
  • Application After Pipeline

The difference between the before- and after pipelines is that in the before pipeline, you have the possibility to "short circuit" the request handling. I.e. you can return a response, which will the be returned directly to the user agent, without even invoking a potential route handler.