Mock for JSON API server.
Project description
Helps client-side Web development by mocking JSON API server.
Installation
hunk can be installed via pip or easy_install:
$ pip install hunk
Or:
$ easy_install hunk
Usage
Setup data directory and files.
Directories under the root have a HTTP method name
Directories and files have name to be resource path
Files have conent to be response JSON
For example:
$ tree demo/simple/
demo/simple/
|-- get
| |-- members
| | |-- 100.json
| | |-- 200.json
| | |-- 300.json
| | ...
| +-- sounds.json
|-- post
| +-- members.json
...
Move to the root directory and run hunk:
$ cd demo/simple/
$ hunk
* Running on http://localhost:8080/
Now, you can access Web API with HTTP:
$ curl http://localhost:8080/members/100
{"gender": "female", "kind": "human", "name": "Dorothy"}
$ curl http://localhost:8080/members
[{"kind": "scarecrow", "name": "Hunk"}, ...]
$ curl http://localhost:8080/sounds
[{"title": "Over The Rainbow"}, ... ]
$ curl http://localhost:8080/members -X POST
{"result": "success"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
hunk-0.1.0.zip
(18.3 kB
view details)
hunk-0.1.0.tar.gz
(8.6 kB
view details)
File details
Details for the file hunk-0.1.0.zip
.
File metadata
- Download URL: hunk-0.1.0.zip
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701f384da556502b213d808dae93fa5ab9eb8cfdb64335c29aa0d5f1a288053e |
|
MD5 | 3e88c33a7127c7caaeacc033d2374f18 |
|
BLAKE2b-256 | f41777b48274c17ee0202cebd1dda4578dc11319e5ac8ad90c57be32f5bf0d36 |
File details
Details for the file hunk-0.1.0.tar.gz
.
File metadata
- Download URL: hunk-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d098e0a6ce2bad0bcb5c23bcc70bb5d8d10e8c401434dba3354be80dbfa7d5ab |
|
MD5 | 2f8a4fe0636a378a17a2b7a3d0b56523 |
|
BLAKE2b-256 | b103ae015d480d14e548231736151355d000640be18e5b05927eaa1daae13ae7 |