i am working with hapijs and swagger plugin for API's. I need to push my code on production server but i don't know how exactly i can disable Swagger API Documentation UI without affecting my API's functionality.
Per the documentation you can turn off the documentationPage
by setting the options during registering. The documentation also shows how to register the plug-in with options.
const hapiSwaggerOptions = {
info: {
title: 'Documentation',
version: '1.0.0',
description: 'This is the API'
},
documentationPage: process.env.NODE_ENV !== 'production'
};
await server.register([
Inert,
Vision,
{ plugin: HapiSwagger, options: hapiSwaggerOptions }, ...]);