2. About Brad
๏Started working with Node.js & Express in 2012
๏Always learning - currently guitar, Aurelia
๏Family guy
3. Express
๏http://expressjs.com
๏First Commit - Jan 3, 2010
๏The E in the MEAN stack
๏Build what you want
๏Middleware is key - cors, morgan, etc
N
o
C
ool
Logo
Typical Express REST Endpoint
app.get(‘/’,(req, res, next) =>{
res.send(‘hello world’);
});
req = Incoming HTTP Request
res = Outgoing Response
next = Callback
4. Hapi
๏http://hapijs.com
๏First Commit - Aug 20, 2012
๏Walmart Labs
๏Convention over code
๏Community - NPM, Disney, Auth0, others…
๏Larger Team Development
๏Ren & Stimpy
๏Event Lifecycle
๏Labels
๏Plugins - most of what you need, probably exists, Joi, Boom,
Swagger!
9. Hapi - Plugins - Joi
https://github.com/hapijs/joi
Among the uses are to validate a HTTP payload / message body.
import * as Joi from ‘joi’;
var schema = Joi.object().keys({
username: Joi.string().alphanum().min(3).max(30).required(),
password: Joi.string().regex(/^a-zA-Z0-9]{3,30}$/),
birthyear: Joi.number().integer().min(1980).max(2013),
email: Joi.string().email()
});
10. Hapi - Plugins - Swagger
https://github.com/glennjones/hapi-swagger
One of the plugins that drew me to Hapi
Show
Docs