https://github.com/winterrdog/harry-porter-character-api
This is a simple api to get harry porter characters by making external requests to http://hp-api.onrender.com/api.
https://github.com/winterrdog/harry-porter-character-api
Last synced: 12 days ago
JSON representation
This is a simple api to get harry porter characters by making external requests to http://hp-api.onrender.com/api.
- Host: GitHub
- URL: https://github.com/winterrdog/harry-porter-character-api
- Owner: winterrdog
- License: mit
- Created: 2023-09-14T13:07:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-14T13:27:59.000Z (over 2 years ago)
- Last Synced: 2025-06-04T14:17:15.356Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Harry-porter-character-api
## description
- This is a simple api to get harry porter characters by making external requests to [harry porter api](http://hp-api.onrender.com/api).
- This api is built using `nodejs`, `expressjs`, and `redis`
- I developed this api to learn how to use `redis` as a cache to improve performance and user experience
## prerequisites
_These technologies should be installed on your machine if you attempt to use this API_
- [nodejs](https://nodejs.org/en/download/)
- [redis](https://redis.io/download)
## usage
- install dependencies
```bash
npm install
```
- run server in production mode
```bash
npm start
```
- run in development mode
```bash
npm run start:dev
```
- run test
```bash
npm test
```
## api
- get all characters
```bash
GET /hogwarts/characters
```
- get character by id
```bash
GET /hogwarts/characters/:id
```
## why use `redis`?
- `redis` is used as a cache to improve performance and user experience
- `redis` is used to store data from api in order to reduce the number of requests to the api since it'd be expensive to make a request to the api every time a user requests a character and also there could be a rate limit on the api
- Before storing data into redis, i first converted it into json string using `JSON.stringify()` and then stored it into redis and on retrieval, i converted it back to json object using `JSON.parse()`
## contributors
- [winterrdog](
https://github.com/winterrdog
)
## license
- [MIT](https://opensource.org/licenses/MIT)