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.
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
This app is ready to use in Heroku.
Open your favourite HTTP client and start your requests.
curl -d "name=test&color=cccccc" http://localhost:9393/lists
name
and color
are required parameters. color
must be a hexadecimal color (ex.: cccccc)
curl http://localhost:9393/lists
curl -X PUT -d "name=test&color=cccccc" http://localhost:9393/lists/:id
curl -X DELETE http://localhost:9393/lists/:id
Deleting a list will also deleted all its tasks
curl -d "name=task&list_id=1" http://localhost:9393/tasks
name
and list_id
are required parameters.
curl http://localhost:9393/tasks
curl -X PUT -d "name=test&list_id=1" http://localhost:9393/tasks/:id
curl -X DELETE http://localhost:9393/tasks/:id
- If you want to restore the initial data go to http://localhost:9393/refresh
- If you don't like cURL you can use httpie or Postman:
- Leonardo Faria
- Sabrina Silveira