zedd45 / 2016-js-atl-hapi

Lightning Talk for JS Atlanta - Hapi JS and Services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2016-js-atl-hapi

Lightning Talk for JS Atlanta - Hapi JS and Services

Install

npm i

Boot it!

npm start
# OR
npm run start:dev 
# to reload the server on changes

then, navigate to localhost:3000.

Tests

npm test

Lint

npm run lint

Under the hood

  • blipp - lists the routes (routing table) with optional description config property next to the route
  • config - handles loading different configurations based on the NODE_ENV (hapi devs tend to use confidence for this; I prefer config for various reasons)
  • glue - "sticks" plugins together, with the provided configuration. With config this is doubly powerful, as you can have a different setup for each NODE_ENV
  • good - handles all the log(s), with various adapters for console, file, or even network requests (to POST 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. Like React's PropTypes, except more... robust!
  • lab - testing, built for node with hapi specifically in mind. Forked from mocha, but with built in coverage, reporters, linting, and other conveniences
  • wreck - http library. Think curl in node.

Additional Reading

Hapi Edge

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.

Resources

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!

Twitter

Here's a twiter "moment" from the actual event!

https://twitter.com/i/moments/859819667661230080

About

Lightning Talk for JS Atlanta - Hapi JS and Services

License:MIT License


Languages

Language:JavaScript 100.0%