file-upload-service is a RESTful API server. It has an endpoint that can upload files. All of the uploaded files will be stored in Google Cloud Storage (GCS) in my account. You can use this email account, which has only view permission, to view the files that is already uploaded.
email: publicemailforjob@gmail.com
pw: Gmail-temp-password-2024
- Go 1.22
- Docker or Podman
- clone project by run
git clone https://github.com/bosskrub9992/file-upload-service.git
- From the sent email, Download the attached file named 'key.json' then paste it at the root of the project folder ./file-upload-service
- Run this command
docker run --rm -it -p 3300:80 -p 2525:25 rnwood/smtp4dev
- Open browser and navigate to localhost:3300 to open testing email server
localhost:3300
- Run the server, It will start a REST API server on port 8080.
go run main.go
- Call API by run the below curl command, Please give your own full file path to the '-F' flag. The file can be in jpeg, png or heic format.
curl -L 'http://localhost:8080/api/v1/files' \
-F 'file=@"/Users/s.thunmanuthum/Downloads/please.jpeg"'
- Set the maximum size of the upload file
- Whitelist the allowed content types and file extensions of the upload file
- The service is developed with Go programming language, a modern language that is suited for deploying on cloud.
- The service is stateless.
- The uploaded files are stored in Google Cloud Storage which is highly scalable.
- The email notification is designed to be async with the upload function.
Usually, you can do vertical scaling. But with the above reasons, horizontal scaling is also possible.
- There is unit test implemented at the business logic layer.
- You can do end-to-end testing like in the 'Getting started' part.
- Resource based naming endpoint