Express MinIO example

Run following bash command to create a text file:

echo "Hello World" > hello.txt

Then, run following curl command to upload the file to MinIO storage using form-data:

curl -X POST -F "file=@hello.txt" https://storage-service-adit.zeabur.app:443/upload

To upload to a specific bucket, add the bucket parameter:

curl -X POST -F "file=@hello.txt" -F "bucket=my-bucket" https://storage-service-adit.zeabur.app:443/upload

To upload to a folder within a bucket:

curl -X POST -F "file=@hello.txt" -F "bucket=my-bucket" -F "folder=documents/reports" https://storage-service-adit.zeabur.app:443/upload

Or use this HTML form to upload files:

Available Endpoints:

API Usage:

Folder Examples:

cURL Examples:

# Upload file to default bucket
curl -X POST -F "file=@example.txt" http://localhost:3000/upload

# Upload file to specific bucket
curl -X POST -F "file=@example.txt" -F "bucket=my-bucket" http://localhost:3000/upload

# Upload file to folder in bucket
curl -X POST -F "file=@example.txt" -F "bucket=my-bucket" -F "folder=documents/reports" http://localhost:3000/upload

# Get file
curl http://localhost:3000/objects/my-bucket/filename.txt

# Delete file from specific bucket
curl -X DELETE http://localhost:3000/objects/my-bucket/filename.txt

# Delete file from default bucket
curl -X DELETE http://localhost:3000/objects/filename.txt

# Delete file from folder
curl -X DELETE http://localhost:3000/objects/my-bucket/documents/reports/filename.txt

# Bulk delete files
curl -X DELETE -H "Content-Type: application/json"   -d '{"bucketName":"my-bucket","objects":["file1.txt","file2.txt","folder/file3.txt"]}'   http://localhost:3000/objects

# List files in bucket
curl "http://localhost:3000/api/objects?bucket=my-bucket"

# List files in folder
curl "http://localhost:3000/api/objects?bucket=my-bucket&prefix=documents/"