serve & manage static hosted assets with ease!
- Clone the repo
git clone https://github.com/DevYukine/cdn
- Run it
go run .
You can get the latest docker image with docker pull devyukine/cdn
GET
/
Serve all the assetsPOST
/assets
Upload assetsPATCH
/assets/{name}
Replace assetsDELETE
/assets/{name}
Delete assets
You need to send the file in multipart/form-data
as the file
key
The api will always respond with the application/json format
The filename is defaulted to the name of the uploaded asset. If you want to generate a filename you can set the generate_name
key to true
, the cdn will respond with an object containing a file_name
value
Go 1.14+
Environment Variables:
CONTENT_ROOT
The folder to save assets toPORT
The port to run the server onTOKEN
Optional A token which is required to add/replace/delete assetsREVERSE_PROXY
Optional If this instance runs behind a reverse proxy (e.g. nginx, HAProxy or apache) and should use forward header
- mux - The http router used
We use SemVer for versioning. For the versions available, see the tags on this repository.
- DevYukine - Initial work - DevYukine
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details