@hapi/disinfect code example

Example 1: @hapi/disinfect

const registerPlugins = async (server) => Promise.all([    server.register({        plugin: require('disinfect'),        options: {            disinfectQuery: true,            disinfectParams: true,            disinfectPayload: true        }    })]); registerPlugins(server)    .then(() => {        // ...    })    .catch((err) => {        // ...    })

Example 2: @hapi/disinfect

{    path: '/',    method: 'get',    handler: (request, reply) => {        ...    },    options: {        plugins: {            disinfect: false        }    }}

Example 3: @hapi/disinfect

// example{    path: '/',    method: 'get',    handler: (request, reply) => {        ...    },    options: {        plugins: {            disinfect: {                disinfectQuery: true,                disinfectParams: false,                disinfectPayload: true            }        }    }}

Example 4: @hapi/disinfect

const customSanitizer = (dirtyObj) => {    // ...    return cleanObj;}