This project implements a simple Star Wars API that allows users to search for character information. It is built using Akka HTTP, Akka Actors, and Akka Streams.
To run this project, you need the following dependencies:
- Scala 2.13.8
-
Clone the repository:
git clone <repository_url>
-
Ensure you have Scala and SBT (Scala Build Tool) installed on your system.
-
Navigate to the project directory and run the following command:
sbt
-
Within the sbt terminal, run the following command:
compile
To start the server on port 8080, run the following command within the sbt terminal: run
The server will be accessible at http://localhost:8080
.
- Pull the Docker image: Run
docker pull ghcr.io/cparks1/star-wars-proxy-api:<latest>
, wherelatest
is the latest version of that package. - Run the Docker container: Run
docker run -p 8080:8080 ghcr.io/cparks1/star-wars-proxy-api:<latest>
, wherelatest
is the latest version of that package. - The Docker container should now be running and you can now access the API at http://localhost:8080. If you want to stop running the Docker container, press
Ctrl + C
in the terminal where the container is running.
- From the root of the project directory, run the command
sbt assembly
- In the same path, run
docker build -t star-wars-proxy-api .
- Find the image ID of the newly built Docker image via
docker image ls
. - Run
docker tag <image_id> ghcr.io/<github_username>/star-wars-proxy-api:1.0.1
, where 1.0.1 is the next version following semantic versioning specification. - Login to the GitHub container registry by running
docker login ghcr.io -u <github_username>
. The password it expects is your personal access token with Package write permissions. - Run
docker push ghcr.io/<github_username>/<image_name>:<tag>
.
- Endpoint:
GET /characters/search
- Query Parameter:
name
(required) - The name of the character to search for.
This endpoint retrieves information about a character by their name. If the character is found, it returns detailed information such as name, height, mass, hair color, birth year, species information, films appeared in, and starships flown in.
If the character is not found, the endpoint returns a 404 Not Found response.
The project includes unit tests to verify the functionality of the Star Wars API.
To run the tests, use the following command within the sbt terminal:
test
- Pull the Docker image: Run
docker pull ghcr.io/cparks1/star-wars-proxy-front-end:<latest>
, wherelatest
is the latest version of that package. - Run the Docker container: Run
docker run -p 3000:3000 ghcr.io/cparks1/star-wars-proxy-front-end:<latest>
, wherelatest
is the latest version of that package. - The Docker container should now be running and you can now access the front end via http://localhost:3000. If you want to stop running the Docker container, press
Ctrl + C
in the terminal where the container is running.
- Type a Star Wars character name into the search bar.
- Press the
ENTER
key on your keyboard or pressSearch
.