git kitty Hacking through NYC

hapi.js: API documentation and validation with joi and swagger

so much joi

So I definitely wasn't planning on writing a post today but had some free time and I just had to share! I've been playing around with Hapi.js. Hapi is an HTTP server framework for Node.js (similar to Express) that was developed by Eran Hammer and the team at WalmartLabs. Hapi was developed with the idea in mind that configuration is better than code, meaning you should only need to add configuration options to the plugins you use with minimal code modifications. So plugins are a critical part of the framework and of this post. The two plugins I'm going to focus on today are joi, maintained by Nicolas Morel, and hapi-swagger, by Glenn Jones.

muse: breaking down the pieces

This is a continuation of muse: a CMS scaffolding tool.

if at first you don't succeed, move on...

So I started to work on the code injection component of muse and came up with a solution I thought was pretty cool. Keeping in mind that depending on which options you add to the muse command the code injected into the files changes. My initial idea was to build a data object like so:

module.exports = {
  content: [
      path: 'server/models/index.js',
      data: 'module.exports = {...}'
      path: 'server/models/User.js',
      basic: {
        data: '// basic strategy auth code'
      oath: {
        data: '// oauh strategy auth code'
      both: {
        data: '// both local and oauth strategies auth code'

muse: a CMS scaffolding tool

the beginning

Muse is my first open source project. I tend to be a bad developer by keeping everything I do and learn to myself. So as I was working on a CMS side project I started thinking about how nice it would be if I could just spin up some basic boilerplate code whenever I needed it. It's similar to a Yeoman generator but a bit more advanced in that there will be lots of code injection depending options selected. And if I would find this tool useful maybe others would too. So sent my code out into the world for the masses to evaluate. They might hate it, but that's not the point. The point is that I would have done it.

theming my site

I started this blog a while ago. Then work got crazy, I hit roadblocks, etc. You don't really care and it doesn't really matter. The main blocker I had was theming. I was a designer in another life and while I always value functionality over design, I still want things to look as nice as they can. So where does that leave a full stack dev who's been working in Node for the past year? Frustrated. I didn't want something over designed or under designed and most of all it had to work... responsive, etc. So I stopped working on this whole blog thing for a couple months.