Let's implement authentication in our Hapi server.
We'll copy the hapi-logging folder that we created in the There's more... section of the previous recipe, name it hapi-authentication. We'll also copy the views folder from the main recipe, install the yar module, and create a routes/auth.js file:
$ cp -fr ../adding-logging/hapi-logging hapi-authentication $ cd hapi-authentication $ cp -fr ../express-authentication/views views $ npm install --save yar $ touch routes/auth.js
Let's require the yar module in the index.js module, and require the routes/auth.js file within our routes object:
const yar = require('yar') const routes = { index: require('./routes/index'), auth: require('./routes/auth'), devStatic: require('./routes/dev-static') ...