Quick-Entities is a simple implementation of services to create, read, update and delete any kind of entity.
It exposes REST services and saves the entities in a Mongo database.
A working example is deployed on Heroku: http://quick-entities.herokuapp.com/.
-
Run the application:
$ bundle install
$ ruby app.rb (or ruby app.rb -o 0.0.0.0 if you need to allow access from the network)
Execute a POST request to http://localhost:4567/fruits with the following JSON body:
{
"id":"1",
"name": "Apple",
"color": "red"
}
Note: if you do not provide the id, an id will be generated for you.
Execute a GET request to http://localhost:4567/fruits
Execute a GET request to http://localhost:4567/fruits?color=red
Execute a GET request to http://localhost:4567/fruits/1
Execute a PUT request to http://localhost:4567/fruits/1 with the following JSON body:
{
"id":"1",
"name": "Orange",
"color": "orange"
}
Execute a PATCH request to http://localhost:4567/fruits/1 with the following JSON body:
{
"quantity": 10
}
Execute a DELETE request to http://localhost:4567/fruits/1
Execute a GET request to http://localhost:4567