To run this project follow these steps:
- Make sure to have
Docker
andDocker Compose
set up locally and run the following command:
docker compose up --build
This will start 2 services:
- An express server running with
bun
. - A
redis
instance that will cache the user data fromhttps://reqres.in/api/users
GET /users
fetches a list of all users, initially getting them fromhttps://reqres.in/api/users
. After the first request, the results will be cached inredis
and you'll start getting cached results from the second requests onward.GET /user/:id
gets data from a single user based onid
.POST /user/
creates a newUser
and stores it in theredis
cache. Receives aUser
object in the request's body with the following structure:
{
id: number;
email: string;
first_name: string;
last_name: string;
avatar: string;
}
PUT /user/:id
updates a single user based on itsid
. Receives aUser
object.DELETE /user/:id
deletes a single user based on itsid
from cache.POST /users/reset
clears all users from theredis
cache. After calling this endpoint, theGET /users
endpoint will return the initial list of users fromhttps://reqres.in/api/users