/todo-api

REST API created using Sinatra and ActiveRecord - http://sinatra-todo-api.herokuapp.com

Primary LanguageRuby

Todo API

This is an assignment of Server Side course, from Web and Mobile App Design and Development program, performed in Langara College.

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.

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

httpie

httpie

Postman

Postman

Group

  • Leonardo Faria
  • Sabrina Silveira