Welcome to this incredible superhero API!
This is an API that uses Marvel´s API to get a lot of data from all Marvel´s superheroes and then apply some logic so the front-end gets and uses only the info they need.
The API allows you to:
- Get all the information you need about any superhero, like name, description, image and details.
- Search for a superhero by name.
- Search for all superheroes (it is arranged alphabetically and paged, you can handle the limit up to 50 per page and you can define the offset).
- Post, Get, Put (modify) and Delete your favorites superheroes from a personal favorite list.
- Now you can get only the ID´s of your favorite superheroes list, or you can get the full data that front-end needs of the favorite superheroes list, depending on your needs.
This is a welcome message from the developer of this API:
I really hope you enjoy using this amazing API and I would love for you to tell me
what projects you are working on. Have fun!
This API requires Node.js to run. This API uses MongoDB Atlas, so the database is on the cloud.
Clone the repository and then start the server with:
$ npm run dev
Please take a look at the dependencies that this API uses.
Superhero API uses:
- Body-Parser - Node.js body parsing middleware.
- Express - fast node.js network app framework [@tjholowaychuk]
- lodash - JavaScript utility library
- Mongoose - HTML to Markdown converter
- MongoDB Atlas - Cloud-hosted MongoDB service
- Morgan - HTTP request logger middleware for node.js
- node.js - for the backend
- node-fetch - module that brings Fetch API to Node.js
- underscore - provides functional programming helpers
And of course Superhero API itself is open source with a public repository on GitHub.
For you to use this API you need to now the routes. This are the main routes you may want to use. (We will abbreviate Superhero as SH)
Action | Route |
---|---|
Get first 20 SH | http://localhost:3000/api/characters |
Get list of SH setting limit and offset (*1) | http://localhost:3000/api/characters/:limit/:offset |
Search by name | http://localhost:3000/api/characters/:name |
Get user´s full favorite list(*2) | http://localhost:3000/api/favorites/full-list/:dni] |
Get user´s favorites ID´s list | http://localhost:3000/api/favorites/:dni |
Post user´s favorites | http://localhost:3000/api/favorites/:dni |
Modify (Put) user´s favorites | http://localhost:3000/api/favorites/:dni |
Delete user´s favorites | http://localhost:3000/api/favorites/:dni |
(*1) Limit: number of SH per page (max 50). Offset: from wich number of SH (there are over 1400 SH). Remember that /: means a parameter is ment to be used. For example: http://localhost:3000/api/characters/Hulk will get the Hulk data
(*2) All the favorites request uses DNI (National identity document) as the identifier of the user.
Searching for Hulk:
Getting Superheroes List using limit 50 and setting offset to 1200:
Getting user´s favorite full Data:
POST a new user´s Favorite List
MIT
Free Software, Hell Yeah!