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 :

After a bit of muddling through, I've got my Hapijs server hosting up images for

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.