https://github.com/yanun0323/go-storage
go-storage is a mini file storage service written in Go.
https://github.com/yanun0323/go-storage
docker golang storage-service
Last synced: 7 months ago
JSON representation
go-storage is a mini file storage service written in Go.
- Host: GitHub
- URL: https://github.com/yanun0323/go-storage
- Owner: yanun0323
- License: mit
- Created: 2024-10-10T23:31:30.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-15T20:26:56.000Z (12 months ago)
- Last Synced: 2025-02-02T03:18:04.590Z (8 months ago)
- Topics: docker, golang, storage-service
- Language: Go
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GO-STORAGE
go-storage is a mini file storage service written in Go.
It stores files in SQLite or MySQL database.
## Requirements
- Go 1.20+
- Docker## Usage
1. #### Clone this repo to local
2. #### Copy config and edit
```bash
$ cp config.yaml.example config.yaml
```3. #### Run
```bash
# local run
$ go run main.go# docker build and run
$ docker build . -t go-storage --no-cache
$ docker run -d -p 8001:8001 --name go-storage go-storage
```## API
- ### GET
Get file by filename.
#### PATH
`/file/:filename`
#### Response
- `Success` `HTTP 200`
return file blob
- `Error`
```json
{
"message": "{any error message here}"
}
```- ### POST
Upload file.
#### PATH
`/file`
#### Request
`multipart/form-data`
| Key | Type | Description |
| ---- | ---- | ----------- |
| file | file | File |##### Header
| Key | Type | Description |
| ------------- | ------ | --------------- |
| Authorization | string | Token to verify |#### Response
- `Success` `HTTP 200`
```json
{
"filename": "{filename}"
}
```- `Error`
```json
{
"message": "{any error message here}"
}
```