https://github.com/leonardofaria/todo-api
REST API created using Sinatra and ActiveRecord - http://sinatra-todo-api.herokuapp.com
https://github.com/leonardofaria/todo-api
activerecord api heroku rest ruby sinatra
Last synced: about 1 year ago
JSON representation
REST API created using Sinatra and ActiveRecord - http://sinatra-todo-api.herokuapp.com
- Host: GitHub
- URL: https://github.com/leonardofaria/todo-api
- Owner: leonardofaria
- Created: 2016-06-28T21:19:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-25T19:51:38.000Z (almost 10 years ago)
- Last Synced: 2025-03-24T08:41:09.395Z (about 1 year ago)
- Topics: activerecord, api, heroku, rest, ruby, sinatra
- Language: Ruby
- Homepage:
- Size: 298 KB
- Stars: 4
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Todo API
This is an assignment of Server Side course, from [Web and Mobile App Design and Development](http://langara.ca/programs-and-courses/programs/web-and-mobile-app/index.html) program, performed in [Langara College](http://langara.bc.ca).
It's a simple REST API, created using Sinatra and ActiveRecord.
## Installation
Clone, install dependencies, setup database (`config/environments.rb`), run migrations, add initial data, start server
* `git clone git@github.com:leonardofaria/todo-api.git`
* `bundle install`
* `rake db:migrate`
* `rake db:seed`
* `shotgun config.ru`
## Deployment
This app is ready to use in Heroku.
[](https://heroku.com/deploy)
## Usage
Open your favourite HTTP client and start your requests.
### Create a list (post)
`curl -d "name=test&color=cccccc" http://localhost:9393/lists`
`name` and `color` are required parameters. `color` must be a hexadecimal color (ex.: cccccc)
### Read all lists (get)
`curl http://localhost:9393/lists`
### Update a list (put)
`curl -X PUT -d "name=test&color=cccccc" http://localhost:9393/lists/:id`
### Delete a list (delete)
`curl -X DELETE http://localhost:9393/lists/:id`
Deleting a list will also deleted all its tasks
### Create a task (post)
`curl -d "name=task&list_id=1" http://localhost:9393/tasks`
`name` and `list_id` are required parameters.
### Read all tasks (get)
`curl http://localhost:9393/tasks`
### Update a task (update)
`curl -X PUT -d "name=test&list_id=1" http://localhost:9393/tasks/:id`
### Delete a task (delete)
`curl -X DELETE http://localhost:9393/tasks/:id`
*****
### Notes
* If you want to restore the initial data go to http://localhost:9393/refresh
* If you don't like cURL you can use [httpie](https://github.com/jkbrzt/httpie) or [Postman](https://www.getpostman.com/):
#### httpie

#### Postman

## Group
* Leonardo Faria
* Sabrina Silveira