Skip to content

0xdod/fileserve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Upload Service

This is a Golang http application for uploading and downloading files. It uses AWS S3 for file storage and sqlite3 as a database

Requirements

Installation

  1. Clone the repository: git clone https://github.com/0xdod/fileserve.git
  2. Change to the project directory: cd fileserve
  3. Install dependencies: go mod download

Usage

  1. Run migrations: make up-migrate
  2. Set the environment variables: cp .env.sample .env. Remember to set valid S3 credentials
  3. Start the server: make run
  4. Open your browser and navigate to http://localhost:7000 to access the application.

Endpoints

Upload a File

  • URL: /api/v1/files/upload
  • Method: POST
  • Request Body: Multipart Form data with a file field named file
  • Response: JSON object with the uploaded file details

Get List of Uploaded Files

  • URL: /api/v1/files
  • Method: GET
  • Response: JSON array containing the list of uploaded files

Download a File

  • URL: /download/{fileId}
  • Method: GET
  • Response: The file will be downloaded

Testing

To run the unit tests, use the following command:

go test ./...

About

A basic golang application to upload, download and retrieve list of uploaded files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published