EddieSCJ / starwars-api-kotlin

B2W Digital Tech Test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


👾 Star Wars API 👾

Project Tooling

Requirements

Documentation

For documentation purposes, just open the following link: Star Wars API Kotlin Documentation

Description

This api is a simple wrapper for the Star Wars API where you can get information about the characters, planets, starships, vehicles, species, films, and more with a few extra features where you can handle this data however you need.

The api also is documented with OpenAPI Swagger, so if you have any doubt, just open in your browser the follow url: http://domain-you-are-using/api/v0/swagger-ui/index.html

Please, read the content below to know how to use this api and if is there any doubt, please, contact me.

Running

You'll have two options to start the app, the first one you can run the app and environment together in a container.

1. Run in console

If you want just run the app in your java environment without setup any IDE or tool, just run the following from the app root.

chmod +x ./scripts/developer-mode.sh

./scripts/developer-mode.sh

2. Run in your IDE or text editing tool

Once you need debug and see some application logs, or want to use an IDE like Intellij, we strongly recommend you to up the environment with localstack and mongodb and export the following variables to your IDE or any tool you are using.

Environment Variables

MONGO_HOST=localhost
MONGO_USER=admin
MONGO_PASSWORD=password
MONGO_PORT=27017
MONGO_DB=starwars
MONGO_CONTAINER_NAME=mongoservice
AWS_SECRET_KEY=SECRET
AWS_ACCESS_KEY=ACCESS
AWS_REGION=us-east-1
SNS_ENDPOINT=http://localhost:4566
SQS_PLANET_DELETE_URL=http://localhost:4566/queue/planet-delete.fifo
SQS_ENDPOINT=http://localhost:4566
SWAPI_URL=https://swapi.dev/api
ENV=ENV
API_PORT=8080
PROFILE=dev
MONGO_AUTH_SOURCE=admin
KAFKA_BOOTSTRAP_ADDRESS=http://localhost:9093

Once you set it, just run the following command:

chmod +x ./scripts/cache-docker/mount-environment.sh

./scripts/cache-docker/mount-environment.sh

After this, just start the app in your tool.

Testing

1. Run Tests in console

Execute the following commands

chmod +x ./scripts/test-mode.sh

./scripts/test-mode.sh

2. Run Tests in your IDE or text editing tool

Export the following env vars to your tool:

MONGO_HOST=localhost
MONGO_USER=admin
MONGO_PASSWORD=password
MONGO_PORT=27017
MONGO_DB=starwars
MONGO_CONTAINER_NAME=mongoservice
AWS_SECRET_KEY=SECRET
AWS_ACCESS_KEY=ACCESS
AWS_REGION=us-east-1
SNS_ENDPOINT=http://localhost:4566
SQS_ENDPOINT=http://localhost:4566
SQS_PLANET_DELETE_URL=http://localhost:4566/queue/planet-delete.fifo
SWAPI_URL=https://swapi.dev/api
ENV=ENV
API_PORT=8080
PROFILE=test
MONGO_AUTH_SOURCE=admin
KAFKA_BOOTSTRAP_ADDRESS=http://localhost:9093

Once you set it, just run the following command:

chmod +x ./scripts/cache-docker/mount-environment.sh

./scripts/cache-docker/mount-environment.sh

After done it to your tool, just run the tests in your tool.

About

B2W Digital Tech Test


Languages

Language:Kotlin 95.1%Language:Shell 3.8%Language:Dockerfile 1.1%