Skip to main content

json-server.py

PyPI

Fake REST API with zero coding.

This project is heavily inspired by json-server in JavaScript.

Requires Python 3.6+.

Installation

It's highly recommended to install with pipx.

$ pipx install json-server.py

Or install with pip at your own risk:

$ pip3 install json-server.py

Get Started

Create a db.json file with following content:

{
  "posts": []
}

Start a server:

$ json-server db.json

Create a post:

$ curl -H 'content-type: application/json' -d '{"content":"blablabla"}' http://localhost:3000/posts

List all posts:

$ curl http://localhost:3000/posts

Usage

Usage: json-server [OPTIONS] [FILENAME]

  Start a JSON server.

  FILENAME refers to the JSON file where your data is stored. `db.json` will
  be used if not specified.

Options:
  --version        Show the version and exit.
  -b, --bind TEXT  Set address to bind, default as `:3000`
  --help           Show this message and exit.

Note:

  • Collections must be contained in your data file before starting the server, otherwise the server cannot decide the type of resources.

Examples

# Start with default config
$ json-server

# Listen on port 3000
$ json-server -b :3000

# Specify a json file
$ json-server db.json

Release files for json-server-py 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-server-py 0.1.11
File Size Uploaded
json_server_py-0.1.11.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-server-py 0.1.11
File Interpreter ABI Platform
json_server_py-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / json_server_py-0.1.11.tar.gz

Download URL json_server_py-0.1.11.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fb9d6ce9e08d6ebd75e164298055a74e35a6ab9e8ea3f8f537cb6fbc9ca77c7a
BLAKE2b-256 checksum
How to use checksums
e1bc9d4ee6f74537d0addcface24cb269978232717dd3e6dd4d811e7dede1501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1020-azure

Release files / json_server_py-0.1.11-py3-none-any.whl

Download URL json_server_py-0.1.11-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c085f07b08393e94f1ff7966fd8b4a1fcaf8ff9529e2f76860513d0fd8524130
BLAKE2b-256 checksum
How to use checksums
d3b186436f699df0c63120f73b7a017c4d7d95ab8afd14b3edcdefe1289aa7cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.2 Linux/5.15.0-1020-azure

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page