Need to quickly stand up a back-end JSON API for prototyping or educational purposes? Jolt gives you a full REST API with zero coding, powered by Elixir.
-
Create a
db.json
file with your example data:{ "products": [ { "id": 1, "name": "Unicycle", "price": 99.0, "condition": "Excellent" } ], "todos": [ { "id": 1, "title": "Shovel snow", "completed": true }, { "id": 2, "phrase": "Rake leaves", "completed": false } ] }
-
Start Jolt:
$ ./jolt db.json
-
Go to http://localhost:4000/todos, for example, and you'll get
[ { "id": 1, "title": "Shovel snow", "completed": true }, { "id": 2, "phrase": "Rake leaves", "completed": false } ]
Based on the previous db.json
file, you also get the following routes:
GET /products
GET /products/1
POST /products
PUT /products/1
DELETE /products/1
GET /todos
GET /todos/1
POST /todos
PUT /todos/1
DELETE /todos/1
GET /db
If you make POST, PUT, or DELETE requests, changes are automatically saved to db.json
.
Jolt is intended to be used as a command-line tool. As such, you'll
need to run the following to create the jolt
executable:
mix deps.get
mix escript.build
Inspired by json-server
MIT - Mike Clark