npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

swagger-express-middleware-with-chance

v1.1.5

Published

Swagger middleware and use chancejs mocks for Express

Readme

Swagger Express Middleware of chancejs mock version

Swagger middleware and mocks for Express.js

Fork from swagger-express-middleware

Mock data using swagger-mock-parser

This Swagger middleware support random mock data while response schema has no example or default defined.

###Example

paths
  /api/mis/info:
    get:
      summary: Product Types
      description: |
        query mis
      parameters:
        - name: queryString
          in: query
          required: true
          type: string
          description: mis info
      responses:
        '200':
          description: mis user list
          schema:
            $ref: '#/definitions/MisInfoResult'
definitions:
  MisInfo:
    type: object
    properties:
      id:
        type: integer
        format: int32
        description: key
      login:
        type: string
        description: id
      name:
        type: string
        description: name
  MisInfoResult:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description:
        message:
          type: string
        data:
          type: array
          items:
            $ref: '#/definitions/MisInfo'

When you use this example and visit '/api/mis/info' ,you will get

{
  "code": 123124,
  "message": "ORJ78pLt1",
  "data": [
    {
      "id": 6415711236784129,
      "login": "%ORJ78pLt1@qEAv$1A",
      "name": "syBQXMu2!n"
    },
    {
      "id": -571708163489791,
      "login": "Pu)HS%#1LzxEO",
      "name": "Mz[ith3o"
    },
    {
      "id": 2581669118738433,
      "login": "#Ne6slM6cW*acwlG",
      "name": "p)0HAWX6TF^#%%gQg6"
    },
    {
      "id": -8350341267455999,
      "login": "9fZEKmYQ3U^fDV",
      "name": "lZ9Cv@8yoS"
    },
    {
      "id": 2669672256241665,
      "login": "ZQpENhB!nJ9C7Ap^Au",
      "name": "mzWoEQk[EG[yLWy"
    }
  ]
}

The mock data will generate randomly each time by chanceJS,Though it has no meaningful. I suggest you use swagger-mock-file-generator to save a json file with example schema which generated by chancejs. It supports this project or swagger-express-middleware project.

License

Swagger Express Middleware is 100% free and open-source, under the MIT license. Use it however you want.