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

@crafts/mock-server

v0.0.12

Published

Zero config, simple mock server! Keep the mocks close within your code.

Downloads

6

Readme

Mock Server

Zero config, simple mock server! Keep the mocks close within your code.

Features

  1. Simple way to create mock. Example.
  2. Pass blob (mock files pattern) option for custom mock paths.
  3. Proxy to actual server using -p or --proxy. All unmatched requested will be sent to proxy.
  4. Out of the box watch method, if any new file is created/changed within the watch path, server will register them.
  5. Create mocks with dynamic URL for eg. /org/:orgId/projects/
  6. Custom status code and delay.
  7. Disable specific mock using disabled option in mock.json.

Usage

Install it

npm i @crafts/mock-server

Add files

Add JSON files ending with .mock.json, anywhere in repo as show in example

Run the server

npx @crafts/mock-server

Set the base URL

Point at http://localhost:4000

Options available

| Option | description | default | | ------ | ------------------------------ | --------------------------------------------- | | blob | Pattern to match the mocks | /**/*.mock.json | | proxy | Original/actual server address | -- | | root | soruce dir for searching mocks | process.cwd() Path from where script is ran |

How to write mocks

Writing mocks is very easy, for real. Create a json file matching the search pattern (by default: /**/*.mock.json).

Example:

{
  "mocks": [
    {
      "url": "/a",
      "method": "PATCH",
      "response": { "a": 2 },
      "status": 201,
      "delay": 500,
      "disabled": false
    }
  ]
}

Options for mock

| Props | type | Required | | -------- | ------- | -------- | | url | string | true | | method | string | true | | response | object | true | | delay | number | false | | status | number | false | | disabled | boolean | false |

UI

Mock server comes with UI (beta) for better experiance.

Screenshot 2023-02-05 at 10 23 36 PM Screenshot 2023-02-05 at 10 23 45 PM Screenshot 2023-02-05 at 10 23 59 PM

Coming soon

Note: Mock server is in beta, things will break but should not fall apart.

Please follow the board for live updates

https://github.com/users/mukuljainx/projects/5