Socket
Socket
Sign inDemoInstall

koa-swagger-mock

Package Overview
Dependencies
71
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    koa-swagger-mock

It's a middleware for swagger-mock!


Version published
Weekly downloads
65
decreased by-75.1%
Maintainers
1
Install size
18.3 MB
Created
Weekly downloads
 

Readme

Source

koa-swagger-mock

build build download

NPM

Introduce

It's a middleware for swagger-mock!

preview this project, do this!

git clone https://github.com/ShanaMaid/koa-swagger-mock

npm install

npm run test

url: localhost:3000/api/pet/1212121212

Usage

npm install koa-swagger-mock -save

Example

const Koa = require('koa');
const app = new Koa();
const KoaSwaggerMock = require('../lib/koa-swagger-mock');
const path = require('path');
const fs = require('fs');


const swagger = JSON.parse(
  fs.readFileSync(path.resolve(__dirname, '../json/example.json'), {encoding: 'utf8'})
);

const koaSwagMock = KoaSwaggerMock({
  swagger,
  prefix: '/api'
});

app.use(koaSwagMock.routes());
app.listen(3000);

this is mock resp!

http://localhost:3000/api/pet/findByStatus mock resp

API

KoaSwaggerMock({...params})

  • swagger - (Object) - (required) - api can be one of the following.

    • A Swagger JSON Object.
  • prefix - (String) - (optional) - url prefix.

    • default is ''

Keywords

FAQs

Last updated on 19 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc