|
1 | 1 | # API for frog and toad images
|
2 | 2 |
|
3 |
| -It's wednesday my dudes! |
| 3 | +### It's wednesday my dudes! |
4 | 4 |
|
| 5 | +A service that allows you to get a random image of a frog or toad |
| 6 | + |
| 7 | +## Api |
| 8 | + |
| 9 | +### Auth |
| 10 | +* GET `/auth/singup` - registration page. Enter your name, email and password to register an account |
| 11 | +* POST `/auth/singup` - submit registration data. |
| 12 | + |
| 13 | +### Frog api |
| 14 | +* `/api/v1/generateToken` - generates a new token for the user and returns it. Requires basic authentication with an email address as user and password |
| 15 | +* `/api/v1/{token}/frog` - returns a random frog or toad image. Requires token |
| 16 | + |
| 17 | +## "It's wednesday my dudes!" mode |
| 18 | + |
| 19 | +If the current day is wednesday `/api/v1/{token}/frog` returns an image with the text "it's wednesday my dudes" |
| 20 | + |
| 21 | +## Images |
| 22 | + |
| 23 | +Images are stored in the [image folder](images). When starting the service in S3, previously unloaded images are loaded. Next, the service works with the S3 storage |
| 24 | + |
| 25 | +### Examples |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +## Configuration |
| 30 | + |
| 31 | +You have to provide configuration for postgres database and S3 storage: |
| 32 | + |
| 33 | +```yaml |
| 34 | +spring: |
| 35 | + url: |
| 36 | + username: |
| 37 | + password: |
| 38 | +minio: |
| 39 | + endpoint: |
| 40 | + accessKey: |
| 41 | + secretKey: |
| 42 | + bucket: |
| 43 | + autoCreation: true |
| 44 | +``` |
| 45 | +
|
| 46 | +Additional properties you can see in [application.yml](src/main/resources/application.yml) |
| 47 | +## Build and run |
| 48 | +### Dockerfile |
| 49 | +
|
| 50 | +1. Run `docker build -t vitekkor/frog-api-service:latest .` to build docker image |
| 51 | +2. Run docker image: |
| 52 | +```shell |
| 53 | +docker run --name frog-api-service -p 8080:8080 \ |
| 54 | +-v path/to/custom/application.yml:/etc/vitekkor/frogapi/application.yml -d \ |
| 55 | +vitekkor/frog-api-service:latest |
| 56 | +``` |
| 57 | + |
| 58 | +### Docker compose |
| 59 | + |
| 60 | +You can use docker compose to build and run service |
| 61 | + |
| 62 | +#### Configuration |
| 63 | + |
| 64 | +1. Set database password ```POSTGRES_PASSWORD:``` |
| 65 | +2. Set minio credentials |
| 66 | +```yaml |
| 67 | +MINIO_ROOT_USER: |
| 68 | +MINIO_ROOT_PASSWORD: |
| 69 | +``` |
| 70 | +3. Set up volumes (optional) |
| 71 | +4. Run `docker-compose up -d` |
0 commit comments