Service for exposing CRUD operations on a Google Cloud Storage (GCS) bucket, with a Gin REST API.
- Originally a "take-home" assignment for a job interview
- Have a template to use for something else
- Upload a new or existing (update) file to a GCS bucket folder
- List all files in a GCS bucket folder
- Get/Download the contents of a specific file in a GCS bucket folder
- Move a file from one GCS bucket folder to another
- Delete a file from a GCS bucket folder
An active GCS account with at least one available bucket, and at least one bucket folder (two or more bucket folders for moving files between folders).
See the default .env file placeholders
go build./cloud-storage-servicego test -v ./...curl --location 'http://localhost:8080/upload' --form 'file_input=@"/path/to/your/testFile.txt"'{
"message": "success"
}curl --location 'http://localhost:8080/download/testFile.txt'these are the contents of testFile
curl --location 'http://localhost:8080/list'{
"files": [
"test-files/",
"test-files/testFile-1024x576-2.jpg",
"test-files/testFile-1024x576.jpg",
"test-files/testFile.txt",
"test-files/testFile1.txt",
"test-files/testFile1.txt.zip",
"test-files/testFile2.txt",
"test-files/testFile3.txt",
"test-files/testFile4.txt",
"test-files2/"
]
}curl --location --request PUT 'http://localhost:8080/move/testFile.txt?folder=test-files2'{
"message": "success"
}curl --location --request DELETE 'http://localhost:8080/delete/testFile.txt'{
"message": "success"
}