json-server.py
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
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| json_server_py-0.1.11.tar.gz | 4.3 kB | Without provenance | Details for json_server_py-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| json_server_py-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for json_server_py-0.1.11-py3-none-any.whl |
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
|
Security for json-server-py 0.1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.