Introduction to
By Mark Wolfe
What is hapi?
- Built on top of Node.JS
- Developed by a team at Walmart Labs
- Out of the box it includes:
- Authentication
- Validation
- Caching
- Batching
- And more..
Auth
- Out of the box supports:
- Basic
- Cookie
- Also includes Hawk
- MAC based authetication
- passport.js plugin in the works.
- OAuth for GitHub, Twitter..
Validation
- Stand alone validation library
- Validates JSON Data
- Type checking Strings, Numbers, Array
- Required/Optional
- Check against a list of values
- API enables grouping of validations into schemas
Caching
- Caching and Prefetch hooks
- Rule based
- Provides engines for:
- Memory (Experimental)
- Redis
- MongoDB
Monitoring
- Request Logging
- System and process performance
- General events
- Can be written to:
- Console
- File
- HTTP
Testing
- Request injection
- Doesn't require socket connection
- Libraries I use to test:
- mocha
- sinon.js
- chai
Batching
- Invoke a batch of operations
- Designed for use within mobile applications
- Mobile networks SUCK
- Trains
- Large events
- Similar boost to combining assets
Interesting Features
- Request Tails
- Executed after response completion
- Asyncronis
- Good for idempotent operations
- Per route cache configuration
- Live request debugging
Observations
- New framework
- Modular reusable components
- API is still a moving target (1.0 soon)
- Open to contributions
- Prepare to read the code
- Documentation needs more examples
Questions?
- Links
- http://hapijs.com
- http://hueniverse.com/
- @wolfeidau on twitter and github