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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mocker-tester

v1.0.0

Published

Mocker-data-generator tester

Downloads

2

Readme

mocker-api-tester

Support link

mocker-tester is the repository of the api deployed in heroku of this awesome module:

https://github.com/danibram/mocker-data-generator

This project lives in heroku: https://mocker-api.herokuapp.com ##API ####2 routes are exposed:

  • /schema/:name (POST): You must pass in the body a JSON with this structure:

      //Structure
      {schema, options}
    
      //Example
      {
          "schema": {
              "firstName": {
                  "faker": "name.firstName"
              },
              "lastName": {
                  "faker": "name.lastName"
              },
              "country": {
                  "faker": "address.country"
              },
              "createdAt": {
                  "faker": "date.past"
              }
          },
          "options": 5
      }
    
      //Response
      {
        "metadata": {
          "count": 5,
          "generationTime(seconds)": 0.001
        },
        "users": [
          {
            "firstName": "Ignatius",
            "lastName": "Shields",
            "country": "Georgia",
            "createdAt": "2015-04-21T14:26:28.920Z"
          },
          {
            "firstName": "Braxton",
            "lastName": "Heathcote",
            "country": "Sri Lanka",
            "createdAt": "2015-03-16T19:04:37.245Z"
          },
          {
            "firstName": "Marlin",
            "lastName": "Morar",
            "country": "Kuwait",
            "createdAt": "2015-12-03T04:53:37.689Z"
          },
          {
            "firstName": "Emmanuel",
            "lastName": "Bernhard",
            "country": "Togo",
            "createdAt": "2015-08-25T14:40:59.559Z"
          },
          {
            "firstName": "Hermina",
            "lastName": "Heathcote",
            "country": "Marshall Islands",
            "createdAt": "2015-09-19T07:24:54.477Z"
          }
        ]
      }
  • /schemas (POST): You must pass in the body a JSON with this structure:

      //Structure
      [{name, schema, options}, {name, schema, options}, {name, schema, options}, ...]
    
      //Example
          [{
            "name": "users",
            "schema": {
                "firstName": {
                    "faker": "name.firstName"
                },
                "lastName": {
                    "faker": "name.lastName"
                },
                "country": {
                    "faker": "address.country"
                },
                "createdAt": {
                    "faker": "date.past"
                }
            },
            "options": 5
        },{
            "name": "cats",
            "schema": {
                "name":{
                    "values": ["pitxi", "txury", "kitty"]
                }
            },
            "options": 4
        }]
    
        //Response
        {
        "users": [
          {
            "firstName": "Ila",
            "lastName": "Hackett",
            "country": "Morocco",
            "createdAt": "2015-04-18T05:37:56.118Z"
          },
          {
            "firstName": "Breana",
            "lastName": "Larkin",
            "country": "Haiti",
            "createdAt": "2015-10-30T17:50:09.801Z"
          },
          {
            "firstName": "Rory",
            "lastName": "Hilpert",
            "country": "Togo",
            "createdAt": "2015-04-30T08:40:01.859Z"
          },
          {
            "firstName": "Dawn",
            "lastName": "McClure",
            "country": "Kiribati",
            "createdAt": "2015-11-28T01:23:42.825Z"
          },
          {
            "firstName": "Rosemarie",
            "lastName": "Huels",
            "country": "Uzbekistan",
            "createdAt": "2015-12-15T09:36:49.934Z"
          }
        ],
        "cats": [
          {
            "name": "txury"
          },
          {
            "name": "kitty"
          },
          {
            "name": "kitty"
          },
          {
            "name": "txury"
          }
        ],
        "metadata": {
          "generationTime(seconds)": 0.002
        }
        }

##Curl Examples:

asciicast

  • /schema/:name

    curl -i \
    -H "Accept: application/json" \
    -H "Content-Type:application/json" \
    -X POST --data '{ "schema": { "firstName": { "faker": "name.firstName" }, "lastName": { "faker": "name.lastName" }, "country": { "faker": "address.country" }, "createdAt": { "faker": "date.past" } }, "options": 5 }' https://mocker-api.herokuapp.com/schema/users
    curl -i \
    -H "Accept: application/json" \
    -H "Content-Type:application/json" \
    -X POST --data '{ "schema": { "firstName": { "faker": "name.firstName" }, "lastName": { "faker": "name.lastName" }}, "options": 5 }' https://mocker-api.herokuapp.com/schema/users
  • _/schemas

    curl -i \
    -H "Accept: application/json" \
    -H "Content-Type:application/json" \
    -X POST --data '[{ "name": "users", "schema": { "firstName": { "faker": "name.firstName" }, "lastName": { "faker": "name.lastName" }, "country": { "faker": "address.country" }, "createdAt": { "faker": "date.past" } }, "options": 5 },{ "name": "cats", "schema": { "name":{ "values": ["pitxi", "txury", "kitty"] } }, "options": 4 }]' https://mocker-api.herokuapp.com/schemas

Module Documentation

https://github.com/danibram/mocker-data-generator

License

Licensed under the MIT license. 2015