Skip to content

Conversation

@HughePaul
Copy link

Add index.js file that returns the dist location and version when required:

var swaggerui = require('swagger-ui');
console.log(swaggerui);
{
  version: '2.0.12',
  dist: '/Users/winklerp/Documents/Projects/swagger-ui/dist'
}

This can then be used in a server route, e.g.:

server.route({
    method: 'GET',
    path: '/api-docs/{param*}',
    handler: {
        directory: {
            path: swaggerui.dist
        }
    }
});

@fehguy
Copy link
Contributor

fehguy commented Mar 2, 2014

i don't quite understand why we would want this?

@HughePaul
Copy link
Author

For instance, projects such as hapi-swagger could just add swagger-ui to their package.json, have it fetched from npm and reference the location of the dist/ files instead of copying the js and css files into the project and being out of sync.

fehguy added a commit that referenced this pull request Mar 20, 2014
Add index.js file that returns the dist location when require()d
@fehguy fehguy merged commit 579abd6 into swagger-api:master Mar 20, 2014
vincent-zurczak pushed a commit to roboconf/swagger-ui that referenced this pull request Aug 18, 2016
…istdir

Add index.js file that returns the dist location when require()d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants