Introduction to Hapi Js
Hapi is a rich framework of node js for building applications and services. It enables developers to focus on writing reusable application logic instead of spending time building infrastructure.
Hapi’s most common use case is building web services such as JSON APIs, but it can also be used to build HTTP proxies and as the server component of single page apps or websites.
Why Hapi Js?
Hapi uses plugins to extend its capabilities. Plugins are configured at runtime through code. There are a wide variety of Hapi plugins, for capabilities including routing, authentication, logging, and more. This avoids using of middleware functionality, unlike other frameworks like Express.
Hapi has micro-service architecture and it is also possible to transfer the control from one handler to another based on certain parameters. Another huge advantage with Hapi is that it provides detailed error messages when you misconfigure.
Key features of Hapi js
- Hapi is the only leading node framework without any external code dependencies.
- The most comprehensive authorisation and authentication API is available.
- Extensive set of plugins to avoid use of middlewares.
- Along with protecting server load with payload limits and request timeouts, hapi blocks error messages that could leak information or echo back exploits.
- Hapi is also the only framework that doesn’t rely on outside dependencies.
- Hapi has extensive support for template rendering, including the ability to load and leverage multiple templating engines, partials, helpers (functions used in templates to manipulate data), and layouts.
- Hapi includes the ability to test routes without having to actually start a server, completely avoiding the time overheads and added complexity of the TCP protocol.
This is the first part of my Hapi js series. I’ll be posting more such blogs on Hapi js, right from setting up the server to building small applications and more…