API project using Golang and Redis.
Before you begin, ensure you have met the following requirements:
- You have installed Docker.
- You have installed Docker-Compose
- You have installed the Redis-CLI
-
Clone the repository:
-
Add your API key as an environment variable to your docker-compose:
API_KEY=<your_api_key_here>
-
Build the Docker containers (this will also start the containers):
docker-compose up --build
-
Start the Docker containers (if build isn't required):
docker-compose up
-
Start Redis Session (in a different terminal window):
redis-cli
-
How to set test values in Redis using
migration.sh:
-
This will add all Category/Word pairs with a key starting at 1.
-
Add a 2 column csv to the root level of the project with the first column being category and second being the word.
-
Change Script permissions.
chmod +x migration.sh
-
The Script accepts the csv as and argument. Example of how to run:
./migration.sh <example.csv>
- API currently has 2 endpoints:
-
Status OK check:
http://localhost:3000
-
Word Endpoint (GET) returns json with category and word keys and respected values. This is retrieved by the key created by the order of the CSV:
http://localhost:3000/word/{id}
-
Authentication currently handled by API-TOKEN.
-
More to come...