Triangle Node - Introduction To Hapi
Intro To Hapi
2014-03-18 by Ben Wheeler and Brian Marks (Meetup) (speaker notes)
What
- alternative to express
- originally built for mobile api
Not Express
- configuration over code
- explicit methods over settings
- plugin architecture over middleware
Routes
Route Prerequisites
like angular's resolve (maybe, but nobody knew angular)
Request Lifecycle
- set extension points for hooking into a request
- more granular than middleware
Validation
- specified in
config
block in route - prevalidate all request parameters look good before calling handler
- default error messages tailored for developers, not end users
- customize error messages with localization files (languages/en-us.json)
Plugins and Methods
plugins: caching, authentication et cetera
Templates and Views
Authentication
Caching
multi-strategy key-value store
Other
use lout to generate api documentation