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

@ctuanle/json-serve

v1.0.3-beta

Published

Light, simple yet fast and useful tool for creating fake rest api.

Downloads

16

Readme

JSON-Serve

Lightweight, simple yet fast and useful tool that help you create a fake rest-api for your frontend by serving a json file.

Installation

yarn add @ctuanle/json-serve --dev

or

npm install @ctuanle/json-serve --save-dev

Demo

A simple demo on fly.io. Here is the base api of my demo:

https://jss-demo.fly.dev/

Usage

yarn jss [json-path] [port] [other-options]

| Options | Required | Default | Description | | :---------- | :------: | :-------: | :-------------------------- | | json-path | no | data.json | Path to your json file | | port | no | 3000 | Port on which server run | | --no-strict | no | false | Turn on no-strict mode | | --readonly | no | false | Turn on readonly mode | | --persist | no | false | Turn on save-change-to-disk |

Available methods

  • GET
  • POST
  • PUT
  • DELETE
  • OPTIONS

No-strict mode

By default, you can only post/put/delete to array data. But in no-strict mode, these action are allowed with object type (key-value).

Read-only mode

In this mode, only GET requests are allowed. Default is false.

Persist

Save changes created by POST/PUT/DELETE to your json file. Default is false, so changes are kept only on memory and will be deleted when you turn server off.

Example

You've create a data.json file:

yarn jss data.json 3000

Or if you're too lazy and you don't specify a path, a prompt will appear and ask you if you want to create one with pre-defined data for you:

yarn jss

You want to serve your json file and persist changes:

yarn jss data.json 3000 --persist

Details

If your json file contains this content:

{
  "method": [
    {
      "name": "GET"
    },
    {
      "name": "POST"
    }
  ],
  "protocol": {
    "1": "HTTP",
    "2": "UDP"
  }
}

All available routes are:

/method
/method/[index]
/protocol
/protocol/[index]

GET

To get "protocol", you can go with GET /protocol.

Or to get all methods, go with GET /method.

Plus, with array data, you can filter it with query, for example, to get all method that name is "GET", GET /method?name=GET

POST

With post request, you can update your json file.

If the target resources is an array, received data will be pushed into the array.

Ex: POST /method with body {"name": "PUT"} will turn above data into

{
  "method": [
    {
      "name": "GET"
    },
    {
      "name": "POST"
    },
    {
      "name": "PUT"
    }
  ],
  "protocol": {
    "1": "HTTP",
    "2": "UDP"
  }
}

Please note that if you edit json file manually while the server is running, edited data won't be seen by the server. In that case, restart the server.

PUT

PUT /protocol/0 with body {"name": "PATCH"} and PUT /protocol/2 with body "TCP" will turn above data into:

{
  "method": [
    {
      "name": "PATCH"
    },
    {
      "name": "POST"
    },
    {
      "name": "PUT"
    }
  ],
  "protocol": {
    "1": "HTTP",
    "2": "TCP"
  }
}

DELETE

With DELETE requests, you can delete a specific data.

DELETE /method/2 and DELETE /protocol/2 will turn above data into:

{
  "method": [
    {
      "name": "PATCH"
    },
    {
      "name": "POST"
    },
    null
  ],
  "protocol": {
    "1": "HTTP",
    "2": null
  }
}

Screenshots

Colorful console logging:

Logging Console

Sample response:

Server response