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/star-wars-api.git
# enter the cloned directory
cd star-wars-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
Endpoints | Usage | Params |
---|---|---|
GET /api/planets |
Get all of the planets. | |
GET /api/planets?name=term |
Get all planets with name like term. | term: [String] |
GET /api/planets/:id |
Get details of a single planet. | |
POST /api/planets |
Create a new planet. | name: [String], weather: [String], ground: [String] |
PUT /api/planets/:id |
Edit the details of an existing planet. | name: [String], weather: [String], ground: [String] |
DELETE /api/planets/:id |
Remove the planet. |