fine

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT

README

fine

Rest-API file management service.

Usage

Add configuration file and give CONFIG_FILE to your environment variables. Default is config.yaml in the current directory.

Configuration file could be json, yaml or toml.

export CONFIG_FILE=/path/to/config.yaml
./fine
API

Go to swagger-ui page: http://localhost:8080/api/v1/swagger/index.html

fine server automatically create folders if not exists in PUT and POST requests.

POST
curl -X POST -F "file=@/path/to/file" http://localhost:8080/api/v1/file?path={file_path}
PUT
curl -X PUT -F "file=@/path/to/file" http://localhost:8080/api/v1/file?path={file_path}
GET
curl -o output -X GET http://localhost:8080/api/v1/file?path={file_path}
DELETE
curl -X DELETE http://localhost:8080/api/v1/file?path={file_path}

When deleting a directory add force=true query parameter to delete recursively.

curl -X DELETE http://localhost:8080/api/v1/file?path={directory_path}&force=true
Configuration
log:
  level: info

server:
  port: 8080
  host: 0.0.0.0
  base_path: "" # example as "/fine"

storage:
  local:
    path: /path/to/storage

Development

Click here to see details...

Generate swagger docs if you change api definitions

make docs

Run service

make run

Test with curl

# download file
curl -o example.txt -X GET http://localhost:8080/api/v1/file?path=example.txt
# upload file
echo "Merhaba dünya" > 👋.txt
curl -X PUT -F "file=@👋.txt" http://localhost:8080/api/v1/file?path=👋.txt
# get file
curl -o hi.txt -X GET http://localhost:8080/api/v1/file?path=👋.txt
# delete file
curl -X DELETE http://localhost:8080/api/v1/file?path=👋.txt

Directories

Path Synopsis
cmd
fine command
internal
fs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL