Microservice for handling s3 image hosting
In this microservice, there are 4 endpoints:
- POST /upload
- Accepts an image parsed in base64 format and uploads it to the s3 bucket
- Requires a flag if the image is the primary image of the property or not
- Requires the property id
- Returns the url of the uploaded image
- GET /getImageUrls
- Accepts a property id
- Returns a list of urls of images associated with the property
- GET /getPrimaryImageUrl
- Accepts a property id
- Returns the url of the primary image associated with the property
- GET /listbuckets
- Returns a list of all the buckets in the s3 bucket
- Used as a health check of the service
In application.properties file are set the following properties regarding the AWS S3 bucket:
- aws.s3.bucketName
- aws.s3.url
- aws.s3.region
Additionally, the
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYare set as environment variables, so the service can connect to the pre-configured s3 bucket.
You can manually execute the unit tests by executing gradle test.
Tests are also automatically invoked for code commited or merged in the main branch.