https://github.com/rahul-ghadge/node-superhero-api
Super hero apis - get data related to marvel super heros in json format using node express JS
https://github.com/rahul-ghadge/node-superhero-api
expressjs json nodejs restful-api
Last synced: 3 months ago
JSON representation
Super hero apis - get data related to marvel super heros in json format using node express JS
- Host: GitHub
- URL: https://github.com/rahul-ghadge/node-superhero-api
- Owner: rahul-ghadge
- Created: 2019-12-09T12:02:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-10T09:27:29.000Z (over 6 years ago)
- Last Synced: 2025-03-12T20:22:38.624Z (over 1 year ago)
- Topics: expressjs, json, nodejs, restful-api
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-superhero-api
Super hero apis - get data related to marvel super heros
This application exposes REST APIs for Super heros data
It will provide out the json response in return for success.
Features Implemented :
* `package.json` file constains information about application and dependencies.
* `server.js` file conntains configuration of application like port, body parsing, express, importing routing.
* `routers.js` form `app > routers` directory contains routing for API Endpoints, and calls respective functions from **controller.js**.
* `controller.js` form `app > controller` directory contains functions which returns data on-demand related to super heros in JSON format.
* `superHeros.js` form `app > models` directory holding static data for Super Heros.
---------------------------------------------------------
Run server which will listen requests coming on port: 3000
> node server.js
---------------------------------------------------------
## API Endpoints
Get all super heros via `http://host:port/super-heros`
http://localhost:3000/super-heros **(GET Method)**
- This API will return all super heros from `superHeros.js`
http://localhost:3000/super-heros/Tony **(GET Method)**
- This API will return Iron Mans data
http://localhost:3000/super-heros **(POST Method)**
Request- ```{
"name": "Black panther",
"superName": "Black panther",
"profession": "King",
"age": 30,
"canFly": false
}```
- This API will return success message along with all super hero present in team
http://localhost:3000/super-heros/Wade **(PUT Method)**
Request:- ```{
"name": "Wade",
"superName": "Deadpool",
"profession": "Street fighter",
"age": 28,
"canFly": false
}```
- This API will update Deadpools data from flying to non-flying
Response:- ```{
"message": "Super hero's data updated secretly",
"superHero": {
"name": "Wade",
"superName": "Deadpool",
"profession": "Street fighter",
"age": 28,
"canFly": false
}
}```
http://localhost:3000/super-heros/Wade **(DELETE Method)**
- This API will remove Wade from super heros and return back all other heros