Despite spending the last years dedicating most of my time to AngularJS, I still work with a Java Spring framework on the server side, so I was assuming routing, handlers, authentication was part of both frameworks. I was completely right, and they both also include some interesting plugin mechanisms, as extensibility is far more extended in the Node community than in the Java community, even in enterprise environments.
From my Java perspective, the problem lies in the express vision as opposed to the Hapi.js vision. When you enter Hapi.js website the first 3 words are “A rich framework”. In Expressjs.com you read “Fast, unopinionated, minimalist web framework”. That’s it! As a Java developer converted to AngularJS, I tend to like rich opinionated frameworks over fast, minimalist frameworks. I acknowledge the issues of this approach, so I might favour some middle point, but in Express, you need to install a module to read the body of an incoming request!, and more and more modules for validating the content against the Content-Type headers. Is that insane? Is there a valid reason?
Apart from input/response validation (using Joi as a dependency), Hapi.js includes server-side caching, session (and cookies) management, file/multipart content management, logging, CORS, … or it is trivial to use with their own modules. Also, plugin creation and management is very simple.
From my experience, Hapi.js was easy to use, easier than Express. But as it usually happens on these cases, will it escalate appropriately to the bunch of business and technical requirements a big project have? Hapi.js is not using the native http Node module, but an incompatible new version. Express is just enhancing the native version, keeping the compatibility. This means that you can’t rely on the vast amount of existing examples, nor you can migrate in the future out of Hapi.js in the ever-changing Node environment. Another downside is that Hapi.js keeps doing breaking changes, as it progresses really fast but sometimes it might not be on the right direction.
Summing up, I have only spent a couple of days using Hapi.js, but I feel it is useful if you are not a NodeJS experience and want to develop a small-to-medium project which you predict will not need future enhancement, and it will really boost your team performance. For the rest of use cases, be wary before choosing it as your server-side option, as you might get stuck once your application evolves.
June 30th 2016