Updating AuthProject to Hapi 8.2.x

The latest update of my AuthProject for Hapi has been a while ago, Hapi was still at version 6. Like last time, Hapi is still changing rapidly. Due to that pace my AuthProject was heavily outdated. The updating steps will all be explained in this post and are based upon the thorough Hapi Changelog.

Do note that I have switched to io.js voor development purposes, I am currently unable to test with node.js 0.10.

  1. Update dependencies

    Hapi is now at 8.2.0, Joi is at 4.6.2, Hapi-auth-cookie is at 2.0.0, Mongoose is at 3.8.24

  2. Server initialization

    The Hapi 8 version changed the way in which servers are initialized, the new method is:

    var server = new Hapi.Server();
    server.connection({ port: Config.server.port });
  3. Plugin registration

    Instead of registering a plugin through server.pack.register() it is now done with server.register();

All in all a quick and easy update. I did have some issues with hapi-auth-cookie causing my routing to work incorrectly. Turned out to be due to version 1.3.2 not being compatible with Hapi 8. An update to 2.0.0 fixed this.

There were no changes to code communicating with the Mongo database, nor with the authentication process.

comments powered by Disqus