tam-code / image-upload

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image upload

Image upload is an application built with golang and has rest api to generate upload link and upload image and async message through kafka to handle some data after upload.

Diagram for the app

Installation

Use docker-compose install the app.

docker-compose up -d

Usage

You can use one of the custom secrets to run the demo:

  1. 00000000
  2. aaaaaaaa
  3. 05f717e5

Generate upload link

curl --location 'http://localhost:9521/api/v1/upload-link' \
--header 'X-Secret-Token: 00000000' \
--form 'expiration="2047-10-09T22:50:01.23Z"'

Upload images

curl --location 'http://localhost:9521/api/v1/images/[UPLOAD-LINK-ID]' \
--header 'Content-Type: multipart/form-data;boundary=AaB03x' \
--form 'images=@"[IMAGE-PATH-FROM-YOUR-MACHINE]"' \
--form 'images=@"[SECOND-IMAGE-PATH-FROM-YOUR-MACHINE]"'

Get image

curl --location 'http://localhost:9521/api/v1/images/[IMAGE-ID]' \
--header 'Content-Type: application/json'

Get service statistics

curl --location 'http://localhost:9521/api/v1/statistics' \
--header 'X-Secret-Token: 00000000' \
--header 'Content-Type: application/json'

About


Languages

Language:Go 98.3%Language:Makefile 1.7%