Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fernandospr/quick-entities

Quick-Entities is a simple implementation of services to create, read, update and delete any kind of entity.
https://github.com/fernandospr/quick-entities

Last synced: 2 months ago
JSON representation

Quick-Entities is a simple implementation of services to create, read, update and delete any kind of entity.

Awesome Lists containing this project

README

        

quick-entities
==============

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/.

## Quick Setup

* Install Ruby, Sinatra and MongoDB.

* Run MongoDB.

* 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)
```

## Usage

### Post an entity

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.

### Get the entities

Execute a GET request to http://localhost:4567/fruits

### Filter the entities by an attribute

Execute a GET request to http://localhost:4567/fruits?color=red

### Get one specific entity

Execute a GET request to http://localhost:4567/fruits/1

### Update an entity

Execute a PUT request to http://localhost:4567/fruits/1 with the following JSON body:
```
{
"id":"1",
"name": "Orange",
"color": "orange"
}
```

### Patch an entity

Execute a PATCH request to http://localhost:4567/fruits/1 with the following JSON body:
```
{
"quantity": 10
}
```

### Delete the entity

Execute a DELETE request to http://localhost:4567/fruits/1

### Get all the collections

Execute a GET request to http://localhost:4567