
20

GitHub - cooldrip/jhop: ?Create fake REST API in one sec.
source link: https://github.com/cooldrip/jhop
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
jhop
?Create fake REST API in one sec.
Install
~ $ go get github.com/cooldrip/jhop
Example
Create a file recipes.json
:
{ "recipes": [ { "id": 1, "prep_time": "1h", "difficulty": "hard" }, { "id": 2, "prep_time": "15m", "difficulty": "easy" } ] }
Passing the JSON file to jhop
:
~ $ jhop recipes.json
Now you can go to localhost:6000/recipes
and get the collection:
{ "recipes": [ { "id": 1, "prep_time": "1h", "difficulty": "hard" }, { "id": 2, "prep_time": "15m", "difficulty": "easy" } ] }
or you can just get a single recipe localhost:6000/recipes/1
:
{ "id": 1, "prep_time": "1h", "difficulty": "hard" }
CLI usage
NAME:
jhop - Create fake REST API in one sec.
USAGE:
jhop [global options] command [command options] [arguments...]
VERSION:
0.0.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--port value Set port (default: "6000")
--host value Set host (default: "localhost")
--help, -h show help
--version, -v print the version
TODO
- Single resource
- Custom routes
- Middleware
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK