https://github.com/zhashkevych/s3-file-uploader
Basic HTTP API for file uploading to S3-compatible storage
https://github.com/zhashkevych/s3-file-uploader
Last synced: 3 months ago
JSON representation
Basic HTTP API for file uploading to S3-compatible storage
- Host: GitHub
- URL: https://github.com/zhashkevych/s3-file-uploader
- Owner: zhashkevych
- Created: 2020-03-27T16:15:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-03T06:58:40.000Z (over 5 years ago)
- Last Synced: 2025-07-09T07:02:33.580Z (3 months ago)
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# File Uploading API (to S3 competible storage)
## Blog Post
## Requirements
- go 1.14
- docker & docker-compose## Run Project
Due to localstack usage, ```awscli``` tool is needed for local development.
Install it on mac via ```brew install awscli```
Before running local project, run:
```aws configure``` and set up AWS keys. Don't forget to add them to `docker-compose.yml`
Then, set up bucket using folowing commands:`aws --endpoint-url=http://localhost:4572 s3 mb s3://file-storage`
`aws --endpoint-url=http://localhost:4572 s3api put-bucket-acl --bucket file-storage --acl public-read`
Use ```make run``` to build and run docker containers with application itself and mongodb instance
## API:
### POST /api/upload
Used to upload image for publication
##### Input should be of type "multipart/form-data" with "file" as key to image:
##### Example Response (Status 200 OK):
```
{
"status": "ok",
"url": "http://localhost:4572/file-storage/XVlBzgbaiCMRAjWw"
}
```##### Example Response (Status 400 Bad Request):
```
{
"status": "error",
"url": "failed to open image"
}
```