Lightning Talk for JS Atlanta - Hapi JS and Services
npm i
npm start
# OR
npm run start:dev
# to reload the server on changes
then, navigate to localhost:3000
.
npm test
npm run lint
blipp
- lists the routes (routing table) with optionaldescription
config property next to the routeconfig
- handles loading different configurations based on theNODE_ENV
(hapi
devs tend to useconfidence
for this; I preferconfig
for various reasons)glue
- "sticks" plugins together, with the provided configuration. Withconfig
this is doubly powerful, as you can have a different setup for eachNODE_ENV
good
- handles all the log(s), with various adapters forconsole
, file, or even network requests (toPOST
your logs elsewhere, for instance)h2o2
- creates a proxy handler to, well, proxy requests to another upstream source. Handles simple 1:1 url mapping as well as methods to mutate the outbound request, as well as the inbound response.inert
- creates file & directory handlers for serving static content. (I almost always use directory at this point; it has better built in security.)joi
- validation library for JavaScript. LikeReact
'sPropTypes
, except more... robust!lab
- testing, built for node withhapi
specifically in mind. Forked frommocha
, but with built in coverage, reporters, linting, and other convenienceswreck
-http
library. Thinkcurl
in node.
These guys wrote the book (literally). Some of my colleagues from Walmart show how to set up controllers and models in order to be more organized. Because organized code is hapi code.
Speaking of that book, there are links on the resources page of Hapijs.com that include working boilerplates and tutorials to help you get started quickly!
Here's a twiter "moment" from the actual event!