O'Reilly logo

Developing a hapi Edge: A Rich Node.js Framework for Apps and Services by Foreword by Eran Hammer, Lloyd Benson, Daniel Bretoi, Van Nguyen, Wyatt Preul

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. The handler

The handler at its core, is what handles the incoming request for a specific route. It determines how the request will be “handled.” The configuration for the route plays a critical part in how the handler needs to behave, and since it’s tightly coupled, some configuration for the route needs to be taken into consideration.

When we specify a route for a request, for example, if you’re going to download a file from /downloads/<filename> then it is the handler that has all of the logic in it for finding the file in question in order to send it to the connecting client. The handler may also do several other things, like counting how many times the file has been downloaded, access control making sure not just anyone has access ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required