jigfox
jigfox

Reputation: 18185

Use express and hapijs together

We have a somewhat big nodejs app using express. We started experimenting with hapijs on smaller services and kind of like it more than express. So we'd like to migrate the express app to hapijs. But since the app is already big, and we don't want to do a complete rewrite at once, but rewrite it step by step, so we can do it in more time. Is there any way to use express and hapijs within the same nodejs process and do the routing between those to by routes?

Upvotes: 1

Views: 564

Answers (2)

Doron Segal
Doron Segal

Reputation: 2260

You have a couple of options to do it:

  1. You can run those in two separate servers under a HAProxy and decide which server will answer by the route.
  2. You can run 2 separate servers where Hapi will be in charge on all the routes once the route is not found it will proxy the request to express.

Option 1 will have better performance and help you in the future when you need to scale.

Upvotes: 1

Shubham Verma
Shubham Verma

Reputation: 9933

You should go through on this link: Hecks

It will show you how to mount your express app onto your hapi server.

Upvotes: 2

Related Questions