This is a simple web API for SuperHeroes and their respective powers
-
https://heroes-nuqo.onrender.com
- use the provided endpoints on the
ROUTESsection to test the API.
- use the provided endpoints on the
In order to use this repository you will need the following:
- Operating System (Windows
10+, Linux3.8+, or MacOS X10.7+) - RAM >= 4GB
- Free Space >= 2GB
This application has been built with the following tools:
- Ruby
v3.0.+ - SQlite3
v1.6 - ActiveRecord
v7.0.4 - Rails
v7.0.6
You can setup this repository by following this manual
- Clone the repository
git clone https://github.com/sainamercy/heroes - Ensure the ruby gems are setup in your machine
bundle install - Perform any pending database migrations
rails db:migrate rails db:seed - Run to start the server
rails s- Use provided link and the endpoints on the
ROUTESsection to test the API.
- Use provided link and the endpoints on the
This application is a simple web API that allows users to:
- View all heroes
- View a specific heroe datails
- View all power
- View specific power datails
- Update specific power
- Create assiciation between heroes and powers through heroe_power
Database schema definitions and associations.
-
GET /heroes- Lists all heroes.## RESPONSE SAMPLE [ { "id": 1, "name": "Kamala Khan", "super_name": "Ms. Marvel" }, { "id": 2, "name": "Doreen Green", "super_name": "Squirrel Girl" }, { "id": 3, "name": "Gwen Stacy", "super_name": "Spider-Gwen" } ] -
GET /heroes/:id- Gets details of a specific heroe## RESPONSE SAMPLE { "id": 1, "name": "Kamala Khan", "super_name": "Ms. Marvel", "powers": [ { "id": 1, "name": "super strength", "description": "gives the wielder super-human strengths" }, { "id": 2, "name": "flight", "description": "gives the wielder the ability to fly through the skies at supersonic speed" } ] } -
GET /powers- List all powers.## RESPONSE SAMPLE [ { "id": 1, "name": "super strength", "description": "gives the wielder super-human strengths" }, { "id": 1, "name": "flight", "description": "gives the wielder the ability to fly through the skies at supersonic speed" } ] -
GET /powers/:id- Gets details of a specific power
## RESPONSE SAMPLE
{
"id": 1,
"name": "super strength",
"description": "gives the wielder super-human strengths"
}
PATCH /powers/:id- Update an existing power
## RESPONSE SAMPLE
{
"message": 'Updated successfully'
}
POST /hero_powers- create a newhero_powerthat is associated with an existingPowerandheroe.
## REQUEST BODY SAMPLE
{
"strength": "Average",
"power_id": 1,
"hero_id": 3
}
MIT License
This repository is maintained by:
