Building an API using Ruby on Rails 6.
Ruby Version | 2.5.8 |
Rails Version | 6.0.4.6 |
Database | PostgreSQL |
# clone the project
git clone https://github.com/karinevieira/heroes-api.git
# enter the cloned directory
cd heroes-api
# run the project
docker-compose up --build
# create the development and test databases
rails db:create
# migrate tables to database
rails db:migrate
Open the browser at the address http://localhost:3000
To run tests, run the following command
rspec
For all requests, use an Authorization header, of size >= 10 characters, so that you can only manipulate your data, for example:
curl --request GET \
--url 'http://localhost:3000/api/heroes' \
--header 'Authorization: anyTokenCanBeUsed'
Endpoints | Usage | Params |
GET /api/heroes | Get all of the heroes. | |
GET /api/heroes?name=term | Get all heroes with name like a term. | term: [String] |
GET /api/heroes/:id | Get the details of a single hero. | |
POST /api/heroes | Create a new hero. | name: [String] |
PUT /api/heroes/:id | Edit the details of an existing hero. | name: [String] |
DELETE /api/heroes/:id | Remove the hero. |