todo_api
todo_api copied to clipboard
JSON API for todo project built with Roda + Sequel. Source code for "Ruby on Roda" book.
todo-api
JSON API for todo project built with Roda + Sequel.
Clone the repository
git clone [email protected]:maturbanski/todo-api.git
cd todo-api
Check your Ruby version
ruby -v
The ouput should start with something like ruby 3.0.0
If not, install the right ruby version.
Install dependencies
Using Bundler:
bundle install
Setup Database
This project uses PostgreSQL by default, to setup database for development and test environment use following instructions:
- Create
.env.developmentfor development environment. - Add
DATABASE_URL=postgres:///todo-api-developmentandcreatedb todo-api-developmentlocally. - Create
.env.testfor test environment. - Add
DATABASE_URL=postgres:///todo-api-testandcreatedb todo-api-testlocally.
Migrate database
- To migrate database in development environment use:
rake db:migrate - To migrate database in test environment use:
RACK_ENV=test rake db:migrate - To migrate database in production environment use:
RACK_ENV=production rake db:migrate
Running the app
You can start your application using rackup command.
Generating documentation
You can generate documentation using rake docs command.
Launching tests
You can launch tests using rspec command.
Seed database
To populate data with seeds use rake db:seed command.
Check code style
To check code style using rubocop command.