This project is a backend service that interacts with the Star Wars API (SWAPI) and caches responses using Redis.
- Docker installed on your machine.
-
Clone the repository:
git clone [email protected]:vblidh/swapi-wrapper.git cd swapi-wrapper
-
Install dependencies:
npm install
-
Start Redis using Docker:
docker run -p 6379:6379 -it redis/redis-stack-server:latest
-
Create a
.env
file in the root directory and add the following environment variables:PORT=3000 SWAPI_URL=https://swapi.dev/api
-
Build the project:
npm run build
-
Start the server:
npm start
The server will be running on http://localhost:3000
. You can use the following endpoints:
GET /movies
- Fetches a list of movies.GET /movies/:id
- Fetches details of a specific movie by ID.GET /characters
- Fetches a list of characters.GET /characters/:id
- Fetches details of a specific character by ID.
To start the server in development mode with hot-reloading:
npm run dev