This is a simple Javascript REST API that provides fictitious data from elements of the Starwars universe, such as people, spaceships, planets, and vehicles.
This application was inspired by the following web star wars api: https://swapi.co/
git clone https://github.com/wallacesat/Starwars-api-heroku
cd Starwars-api-heroku
yarn install
yarn start
If you prefer, use
npm
instead ofyarn
After the server starts successfully, you can make requests to the end points of this api.
I recommend the Insomnia.
Request
http://localhost:3001/api/people
Response
{
"count": 40,
"results": [
{
"createdAt": "2019-03-28T22:05:56.493Z",
"_id": "5c9d45440b15835380f9d4ea",
"name": "Walter Obrien",
"avatar": "http://i.pravatar.cc/40?img=0.2983651814934496",
"height": 73,
"mass": 127,
"hair_color": "tewope",
"skin_color": "veraep",
"eye_color": "ejesof",
"birth_year": "29BBY",
"gender": "Female"
},
{
"createdAt": "2019-03-28T22:05:56.493Z",
"_id": "5c9d45440b15835380f9d4e9",
"name": "Jeffery French",
"avatar": "http://i.pravatar.cc/40?img=0.8316213567279407",
"height": 170,
"mass": 139,
"hair_color": "pekedu",
"skin_color": "bezegj",
"eye_color": "vadilf",
"birth_year": "18BBY",
"gender": "Female"
},
]
}
The result content contains an array of 10 items or less.
Use page parameter to fetch more data.
http://localhost:3001/api/people/page=2
You will need internet access, because even if the API is running locally, the data collection is stored in an online database.
For management of routing system, routes, HTTP requests and responses.
To manage database connections.
For the storage of dummy data to be accessed by api, whose data follow the paradigm of the nonrelational model.
- Javascript - w3school: JS tutorial
- ES6 - ECMAScript 2015: Specification
MIT © wallacesat