Today, I needed to configure my Hapijs API server to handle images. Unfortunatley, I couldn't figure out how to do it. To make matters worse, the old 1.2.X versions of the Hapijs docs weren't available. Fortunately, someone on IRC pointed me to the old API docs : https://github.com/spumko/hapi/blob/4c1e598d5a8f9ba667e65746d0a7b5b4cd2a3b8d/docs/Reference.md

After a bit of muddling through, I've got my Hapijs server hosting up images for https://itunes.apple.com/us/app/kids-in-touch/id719526952?mt=8&uo=4&at=1l3vuVr.

To do this just add the following route:

{ method : 'GET',
    path : '/images/{path*}',
    config : {
        auth: true
    },
    handler: {
        directory: { path: './images', listing: false, index: false }
    }
}

The auth: true ensures the images are only served to authenticated users. listing : false prevents displaying a list of all files in the images directory. index: false prevents serving any "index.html" file that may exist in the directory.