Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use Hapi.JS as a Micro-services framework?

I've seen various interesting presentations recently about the joys of Micro Services (http://martinfowler.com/articles/microservices.html) and also wonder how we might use those concepts with Hapi.JS.

The CTO of Mail Online (largest online newspaper on the planet) name checks HAPI and its plugin system in relation to micro-services :

http://www.nearform.com/nodecrunch/how-node-js-has-revolutionized-the-mailonline

A micro-services architecture is used, which was inspired by Fred George, which is a slightly different take on the hapi plugin architecture, structuring applications to be maintainable as they get bigger is a key challenge going forward and micro-services is a solution to this. The MailOnline are also heavy users of Joyent (On Premise SDC and public cloud).

There are also new node frameworks set up specifically for micro-services (senecajs.org)

Has anyone seen any case studies (and ideally tutorials) on leveraging Hapi in this way?

like image 964
a_c_m Avatar asked Apr 10 '14 12:04

a_c_m


People also ask

What is Hapi framework?

Hapi. js (derived from Http-API) is an open-source Node. js framework used to build powerful and scalable web applications. Hapi is commonly used to build Application Programming Interface servers, HTTP-proxy applications, and websites. Hapi.

Which is better express or Hapi?

Express is less opinionated than Hapi, making it more abstract. While both frameworks can be extensible and adaptable, they can provide the same functionalities through different architectures.

Is Javascript good for Microservices?

js being event-based is a very good fit for microservices. With things like streams and real-time capabilities, choosing Node. js for your next microservice should be a no brainer.

CAN node js be used for Microservices?

The event-driven architecture of Node. js makes it a perfect choice for microservices, being fast, highly scalable, and easy to maintain.


1 Answers

Sure, you can use HapiJS, any other web framework, or even just plain old node libraries.

Microservices are just about structuring an application (or applications) in smaller bits, rather than a monolithic app. They are not a silver bullet or anything complicated, in fact they are generally quite simple.

HapiJS's role would be to expose data over HTTP, which should be fine unless you are building an extremely performance sensitive app.

Of course, one thing that microservices enables is the use of different technologies. You could try out different web frameworks for each service and see which you prefer - they are all capable of doing the same things.

like image 193
Dan Avatar answered Sep 21 '22 04:09

Dan