Snapfile is a REST file upload/download service that allows users to download files for a specific amount of time. The file is deleted once the predermined download quota is met. Written in Go. The frontend is under development.
- Though it is optional, you should install docker and docker-compose. It helps with obtaining a PostgreSQL instance.
- Run
make setup
to install go dependencies. - If you have docker/docker-compose installed, run
make up_db
to spin up the Postgres instance. - Go to the
Makefile
and verify your DB credentials underrun
. - Finally, run
make run
to start the service. The server listens and serves on port3000
by default.
The API provides the following end points:
Endpoint | Method(s) | Instructions |
---|---|---|
/v1/upload | POST |
required form-data : file and max_downloads . optional: preferred_url . See below. |
/v1/download/:url | GET |
url will be provided to you when you upload a file. |
/v1/ping | GET |
simple api health check |
In order to upload a file to the API, you need to provide the following form-data
in the body of your POST
request.
form-data key | Reuired/Optional | Explanation |
---|---|---|
file |
Required | The file you want to upload. |
max_downloads |
Required | The number of times you want users to download the file before it gets deleted. |
preferred_url |
Optional | Your url preference. If a preferred url is not provided or is not available, an UUID is generated. |