Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa2-swagger-ui

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa2-swagger-ui - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

2

examples/example.js

@@ -12,3 +12,3 @@ const Koa = require('koa');

app.listen(3000);
console.log('listening on port: 3000');
console.log('listening on: http://localhost:3000/docs');
}
const path = require('path');
const fs = require('fs');
const defaultsDeep = require('lodash.defaultsdeep');
const send = require('koa-send');
const Handlebars = require('handlebars');
const rootPath = path.join(__dirname, '../public');
const defaultOptions = {

@@ -26,13 +23,7 @@ title: 'Swagger UI',

return function koaSwaggerUi(ctx, next) {
if (ctx.path === options.routePrefix) {
ctx.type = 'text/html';
ctx.body = index(options);
return next();
}
if (ctx.path.indexOf(options.routePrefix) === 0) {
const truePath = ctx.path.substring(options.routePrefix.length, ctx.path.length);
return send(ctx, truePath, { root: rootPath });
}
ctx.assert(ctx.path === options.routePrefix, 404);
ctx.type = 'text/html';
ctx.body = index(options);
return next();
};
};
{
"name": "koa2-swagger-ui",
"version": "2.0.1",
"version": "2.1.0",
"description": "Swagger UI middleware for koa",

@@ -13,3 +13,2 @@ "main": "lib/index.js",

"handlebars": "^4.0.6",
"koa-send": "^3.3.0",
"lodash.defaultsdeep": "^4.6.0"

@@ -16,0 +15,0 @@ },

@@ -18,22 +18,2 @@ const lint = require('mocha-eslint');

});
it('should return swagger-ui-bundle', function(done) {
request(app.listen())
.get('/docs/swagger-ui-bundle.js')
.expect('Content-Type', /javascript/)
.expect(200)
.end((err) => {
if (err) return done(err);
return done();
});
});
it('should return favicon', function(done) {
request(app.listen())
.get('/docs/favicon-32x32.png')
.expect('Content-Type', /image\/png/)
.expect(200)
.end((err) => {
if (err) return done(err);
return done();
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc