- File Upload: Upload files with a maximum size of 10 GB.
- File Retrieval: Retrieve uploaded files using their filenames.
- File Deletion: Delete files with filename.
- Go installed on your machine.
-
Clone the repository:
git clone https://github.com/your-username/your-repository.git
-
Change into the project directory:
cd your-repository
-
Run the application:
go run main.go
The server will start on http://localhost:5051.
-
To upload a file, make a POST request to the root endpoint (
/
) with the file in the request body.curl -X POST -F "file=@/path/to/your/file" http://localhost:5051/
Note: Replace
/path/to/your/file
with the actual path to the file you want to upload. -
The response will include a message indicating whether the upload was successful and the filename.
-
To retrieve an uploaded file, make a GET request to the endpoint
/:filename
, where:filename
is the name of the file you want to retrieve.curl http://localhost:5051/your_filename
Note: Replace
your_filename
with the actual filename you want to retrieve. -
The file will be served to the client.
-
To delete an uploaded file, make a DELETE request to the endpoint
/:filename
, where:filename
is the name of the file you want to delete.curl -X DELETE http://localhost:5051/your_filename
Note: Replace
your_filename
with the actual filename you want to delete. -
The file will be deleted
- The service checks for malicious file types and prevents the upload of executable files with certain extensions. If a file with a restricted extension is detected, the service will respond with an error message.
docker compose up
docker build -t cdn-server .
docker run -d -p 5051:5051 cdn-server
docker run -d -v /path/to/your/bucket:/app/bucket -p 5051:5051 --restart always 01822531439/cdn