Alien::SwaggerUI - Render OpenAPI spec documentation with Swagger-UI
version 0.002
use Alien::SwaggerUI; my $app_dir = Alien::SwaggerUI->root_dir; #-- Serve Swagger-UI with Mojolicious::Lite use File::Spec::Functions qw( catfile ); use Alien::SwaggerUI; use Mojolicious::Lite; get '/swagger/*path' => { path => 'index.html' }, sub { my ( $c ) = @_; my $path = catfile( Alien::SwaggerUI->root_dir, $c->stash( 'path' ) ); my $file = Mojo::Asset::File->new( path => $path ); $c->reply->asset( $file ); }; app->start;
This module contains Swagger UI. This pure-JavaScript application renders beautiful documentation for your application's OpenAPI specification.
The application is contained in a share/ directory. You can get the path to this directory with the root_dir method.
share/
root_dir
To render your specific API documentation, pass it in with the ?url=/path/to/spec query parameter.
?url=/path/to/spec
Doug Bell <preaction@cpan.org>
Gaurav Rai <gauravrai7860@gmail.com>
Mohammad S Anwar <mohammad.anwar@yahoo.com>
This software is Copyright (c) 2016 by Doug Bell.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Alien::SwaggerUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alien::SwaggerUI
CPAN shell
perl -MCPAN -e shell install Alien::SwaggerUI
For more information on module installation, please visit the detailed CPAN module installation guide.