diff --git a/package.json b/package.json index fe84bf1..0ae1efe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-swagger", - "version": "0.1.5", + "version": "0.1.6", "description": "A set of tools for generating Swagger API documentation based on the HTTP nodes deployed in a flow", "license": "Apache", "repository": { @@ -22,7 +22,7 @@ "Cody Walker " ], "dependencies": { - "swagger-ui": "2.1.3", + "swagger-ui": "2.1.4", "i18next-client": "1.10.3" } } diff --git a/swagger/swagger.js b/swagger/swagger.js index 97d6c8a..5f30bd0 100644 --- a/swagger/swagger.js +++ b/swagger/swagger.js @@ -1,5 +1,5 @@ /** - * Copyright 2015 IBM Corp. + * Copyright 2015, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -162,11 +162,15 @@ module.exports = function(RED) { } RED.httpAdmin.get('/swagger-ui/reqs/i18next.min.js', function(req, res){ - var filename = path.join(__dirname , '../node_modules/i18next-client/i18next.min.js'); + var basePath = require.resolve('i18next-client'); + basePath = basePath.replace(/\/i18next.js$/,""); + var filename = path.join(basePath,'i18next.min.js'); sendFile(res,filename); }); RED.httpAdmin.get('/swagger-ui/reqs/*', function(req, res){ - var filename = path.join(__dirname , '../node_modules/swagger-ui/dist', req.params[0]); + var basePath = require.resolve('swagger-ui'); + basePath = basePath.replace(/\/swagger-ui.js$/,""); + var filename = path.join(basePath, req.params[0]); sendFile(res,filename); }); RED.httpAdmin.get('/swagger-ui/nls/*', function(req, res){