The Hapi framework enables developers to focus on writing reusable application logic instead of spending time building infrastructure.

Nodeschool.io has a workshop listed called makemehapi created by @linclark

I love Nodeschool workshops and this was one of the better ones. Great weekend fun finding the solutions and I definitely want to continue using Hapi.

makemehapi


Proficient enough at the end to just start writing code? Yep.


&yet Present Eran Hammer on Hapi 2.0 - Jan 2014


And how's this for an instant proxy?

1 var Hapi = require('hapi'); // Import the library
2
3 var server = new Hapi.Server('localhost', (process.stdin[2] || 3000)); //  Host and port you designate or port 3000
4
5 server.route({
6   method: '*',              // Any of the HTTP methods
7   path: '/{path*}',         // Any path and follow recursively
8   handler: {
9     proxy: {
10       host: 'google.com',  // http://localhost:3000/search?&q=hapijs
11       redirects: 5,        // Sixth redirect gives back error 300
12     }
13   }
14 });
15
16 server.start(); // kick it


TODO: Read up on Function expressions vs. Function declarations

https://kangax.github.io/nfe/

var rot13 = require('rot13-stream')(); // WTF double brackets?


Published

16 November 2014

Category

development

Tags