Skip to content

A simple server that takes a file and uploads it to an S3-compatible storage

Notifications You must be signed in to change notification settings

dtinth/upload-endpoint

Repository files navigation

upload-endpoint

A simple server that lets me upload file and puts it in an S3-compatible cloud storage.

Environment Variables

STORAGE_ENDPOINT=
STORAGE_BUCKET=
STORAGE_AK=
STORAGE_SK=
STORAGE_REGION=
STORAGE_PUBLIC_URL=
UPLOAD_KEY=

What it does

This server lets me upload files via multipart/form-data:

multipart/form-data upload

curl -X PUT "http://localhost:10847/upload?path=hello.html" -H "Authorization: Bearer $UPLOAD_KEY" -F file=@fixtures/hello.html

The file is saved to an S3-compatible storage, and a URL is returned in JSON format:

{ "url": "https://media.mjth.live/hello.html" }

raw upload

curl -X PUT "http://localhost:10847/upload-raw?path=hello.txt" -H "Content-Type: text/plain" -H "Authorization: Bearer $UPLOAD_KEY" -d meow
{ "url": "https://media.mjth.live/hello.txt" }

About

A simple server that takes a file and uploads it to an S3-compatible storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages