Log in

goodpods headphones icon

To access all our features

Open the Goodpods app
Close icon
CodeWinds - Leading edge web developer news and training | javascript / React.js / Node.js / HTML5 / web development - Jeff Barczewski - 002 First look at Hapijs 2.0, the Node.js web framework from Walmart Labs

02/01/14 • 21 min

plus icon
bookmark
Share icon

This is a review of the Hapi 2.0 functionality unveiled last Monday, Jan 27, 2014 at &yet. The event was live streamed so I was able to watch and take notes. Eran Hammer @eranhammer, a Walmart labs engineer and lead developer for Hapi shared a top to bottom feature discussion including the new changes for version 2. Eran’s Slides

My goal with this podcast is to mention some of the key changes with Hapi 2 and how you would leverage them in your code.

This review and Eran’s presentation are done such that you do not need have a familiarity with Hapi to get value, new users should come away with some understanding of Hapi and how it can be useful for building robust web applications.

  1. Episode Info
  2. Episode Notes
    1. Background
    2. Routes, Caching, State
    3. Plugins
    4. Authorization
    5. Ops
    6. Postmile example app
  3. Major breaking changes
  4. Resources
  5. Summary

Episode Info

  • Episode: CW 002
  • Published: February 1st, 2014
  • Tags: nodejs, hapijs
  • Duration: 21:46

Episode Notes

Background

  • show notes http://codewinds.com/podcast/002.html
  • I have a link to the original live stream, the content starts at about 24 minutes in, so the URL in the show notes jumps directly to that spot.
  • Hapi is the awesome open source web framework created by Walmart Labs.
  • The Hapi framework grew out of years of development first at Yahoo as Sled, later renamed Postmile, then at Walmart Labs.
  • Initially Eran tried to build on Express a popular web framework, but found issues with plugin order, undocumented dependencies, fragility with large team use.
  • Hapi was developed by Walmart Labs for their mobile division
  • Hapi is built as a scalable web framework that they could use to evolve their system over time.
  • Initiallly used to reverse proxy or pass through requests to their existing backend written in java or other languages.
  • Then decorate, batch, and begin to replace legacy code with new code in Node.js
  • It ran 100% of their mobile traffic starting with Black Friday and proved its stability running at about 1-2% cpu on 50 servers throughout the highest load. Lasagna graphs flatlines for cpu and memory use
  • Walmart starting to replace more of its legacy code with Hapi and even now part of walmart.com
  • Hapi has great REST API support as well as infrastructure for building web apps or even serving static content
  • Just configure the routes and you are ready, no extra plugins are necessary for the most common functionality
  • Liked that Eran provides some quick commentary about features and how they evolved
  • Hapi 2.0 isn’t a massive increase in new functionality, in fact it is more about taking out the cruft, eliminating the redundant ways to do things. Names that evolved over time, picking the best and cleaning up the others.
  • This strategy shows the wisdom and experience of its architect, to resi the urge to add features by first solidifying the base.

Routes, Caching, State

  • Route handler(request, reply) signature changed
  • server.route({}), can keep routes in one place while config and handler in separate module. validation is configurable, state (cookies)
  • server.table() gives you the active routing table
  • Hapi is a configuration centric framework, set js properties, then it tries to stay out of your way.
  • Hapi is written so the meat of your web application can stay pure, you don’t have to deal with the HTTP mechanisms unless you need to for a special case. This leads to clean code which is more focused on your business logic and less on how to deliver via HTTP.
  • Helpers can abstract out functionality used in many places like looking up a user profile or users shopping cart
  • Caching is changed in 2.0, dropping support for full page caching. You can still configure the client cache headers and expiry but the team removed the ...

02/01/14 • 21 min

plus icon
bookmark
Share icon

Generate a badge

Get a badge for your website that links back to this episode

Select type & size
Open dropdown icon
share badge image

<a href="https://goodpods.com/podcasts/codewinds-leading-edge-web-developer-news-and-training-javascript-reac-23131/002-first-look-at-hapijs-20-the-nodejs-web-framework-from-walmart-labs-818819"> <img src="https://storage.googleapis.com/goodpods-images-bucket/badges/generic-badge-1.svg" alt="listen to 002 first look at hapijs 2.0, the node.js web framework from walmart labs on goodpods" style="width: 225px" /> </a>

Copy