swagger-node icon indicating copy to clipboard operation
swagger-node copied to clipboard

How to open swagger documentation

Open MrEldin opened this issue 8 years ago • 2 comments

Hi,

My question is, how to open swagger documentation, to show my frontend team the exact routes that they can use, I thought about this Documentation.

Thanks

MrEldin avatar Aug 02 '17 15:08 MrEldin

@MrEldin you'll need to add swagger-ui into your project. Either the static dist or via npm https://www.npmjs.com/package/swagger-ui

Afterwards just serve the static files from the api you're using. In hapi it'd look something like this:

    app.register(require('inert'), (err) => {
        if (err) {
            throw err;
        }

        app.route({
            method: 'GET',
            path: '/{param*}',
            handler: {
                directory: {
                    path: 'dist'
                }
            }
        });
    });

joshualim92 avatar Oct 09 '17 18:10 joshualim92

You may also just run the docker container, provided by swagger-ui. See #524 for details.

MrApe avatar Oct 13 '17 15:10 MrApe