Skip to content

Sample http file server (download, upload and remove).

Notifications You must be signed in to change notification settings

lillilli/http_file_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP File Server

Test project.

Description

HTTP File Server - server, providing http API for downloading, uploading and removing files by their md5 hash string. All files store in directory, which is setting up from the config file.

HTTP API

Health

GET /health

Response:

200 OK

Upload

Uploading file to the server. File is setting up by the form, field "upload".

POST /upload
Content-Type: multipart/form-data

Response:

200 OK

"file hash"

Download

Downloading file from the server.

POST /download/{file_hash}

Response:

200 OK

"file data"

Delete

Removing file by his md5 hash.

POST /delete/{file_hash}

Response:

200 OK

ok

Local launch

Requirements

You need to have vgo installed.

go get -u golang.org/x/vgo

Launch

  1. Clone the repository.
  2. Install dependencies, create the config file.
  3. Create static files directory, based on config file.
  4. Launch the project.
git clone https://github.com/lillilli/http_file_server.git && cd http_file_server
make setup && make config
mkdir -p shared/static
make run

Docker

  1. Clone the repository.
  2. Make image (need some time).
  3. Launch image (will be available on localhost:8080).
git clone https://github.com/lillilli/http_file_server.git && cd http_file_server
make image
make run:image