Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jason-server

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jason-server

JSON as REST API

  • 0.8.1
  • PyPI
  • Socket score

Maintainers
1

Jason Server

PyPI PyPI - Python Version PyPI - Status PyPI - License

Get a full fake REST API

Table of contents

  • Jason Server

Getting started

Install Jason Server

pip3 install jason-server

Create a db.json file with some data

{
  "articles": [
    { "id": 1, "title": "jason-server", "author": "1" },
    { "id": 2, "title": "jason-routes", "author": "1" }
  ],
  "authors": [
    { "id": 1, "name": "bob"}
  ]
}

Start JSON Server

jason-server watch db.json

Now if you go to http://localhost:8080/articles, you'll get

{ "id": 1, "title": "jason-server", "author": "1" },
{ "id": 2, "title": "jason-routes", "author": "1" }

Routes

Singular Routes

GET /authors
Plural Routes
GET /authors
GET /authors/1

Filter

GET /articles?title=title&author=eminem

Pagination

Use _page and _limit to paginate data.

In the Link header you'll get first, prev, next and last links.

GET /articles?_page=2
GET /articles?_page=3&_limit=15

Sorting

Use _sort and _order (defaults order: asccendant)

GET /persons?_sort=age
GET /persons?_sort=name&_order=desc

Database

GET /db

Extras

Alternative Host

You can start JSON Server on other host with the --host flag:

$ json-server --host "0.0.0.0" watch db.json

Default: localhost

Alternative Port

You can start JSON Server on other ports with the --port flag:

$ json-server --port 8100 watch db.json

Default: 8080

CLI Usage

Usage: jason-server [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --host TEXT     Host adress
  -p, --port INTEGER  Port
  -q, --quiet
  --version           Show the version and exit.
  --help              Show this message and exit.

Commands:
  watch  Run your database as REST Api

Credits

License

The code is available under the MIT license.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc