This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

This page explains the support of the Hapi.js framework.

Server

For example, create a server - index.js:

const Hapi = require('hapi');

// Create Server
const server = new Hapi.Server();

This will give the following result:

Routes

For example, create a route for a server:

server.route([     
	{
        method: 'GET',
        path: '/api/directors/{id}',
        handler: api.directors.get,
        config: {
            tags: ['api'],
            description: 'Get one director by id',
            notes: 'Get one director by id',
            validate: {
                params: {
                    id: Joi.number().required()
                }
            },
            cors: {
                origin: ['*']
            }
        }
    }
];

This will give the following result: