Coder Social home page Coder Social logo

fileuploaderapp's Introduction

File uploads service

REST upload file service.

Service can:

  • Upload files to the store (currently, only filesystem, but it pluggable and can be replaced with DB, S3 or something);

  • Download files by it identifier.

For launching (based on image on docker hub):

Open console (e.g. linux shell) and cd to user's folder, cd ~/

mkdir fileuploaderapp && cd fileuploaderapp 
mkdir logs
mkdir uploads
mkdir nginx
wget -P nginx https://raw.githubusercontent.com/alexkuznetsov/FileUploaderApp/dev/nginx/nginx.conf
wget https://raw.githubusercontent.com/alexkuznetsov/FileUploaderApp/dev/docker-compose.yml
docker-compose up

After that, Docker retrives the last version of the container and launches it.

Build image locally

git clone https://github.com/alexkuznetsov/FileUploaderApp.git
cd FileUploaderApp
git checkout dev
mkdir logs
mkdir uploads
docker-compose -f docker-compose-local.yml up

Endpoints

  1. /api/token

    Authentication endpoint, checks username/password pair and returns JWT for upload endpoint.

    Sample request:

{
    "username": "admin", 
    "password": "1qaz!QAZ" 
} 
  1. /api/upload Upload endpoint. Can consume:

    • Multipart Form Data;
    • JSON, with base64 encoded file (
      { 
          "files": [{ 
              "file": "1.jpg", 
              "data": "base64;iVBORw0KGgoAAAANSUhEUgAAAT4AAAE+CAYAAAAUOHwwAAAgAElEQVR4nOy9WaxtW3qQ9412dmutvXZz9t..." 
          }] 
      }  
      
      );
    • JSON, with links for download files (
      { 
          "links": [ "http://localhost/1.bmp", "http://localhost/2.bmp" ] 
      }
      
      );
    • Mix of base64 encoded files and links (
      { 
          "files": [ { 
              "file": "1.jpg", 
              "data": "base64;iVBORw0KGgoAAAANSUhEUgAAAT4AAAE+CAYAAAAUOHwwAAAgAElEQVR4nOy9WaxtW3qQ9412dmutvXZz9t..." 
          } ], 
          "links": [ "http://localhost/1.bmp", "http://localhost/2.bmp" ] 
      }
      
      ).
  2. /api/file/{fileId}

    Download file endpoint

  3. /health

    Health check endpoint

Configuration

Maximum request body size (e.g. total upload size limit) can be changed by setting FILEUPLOADERAPP_LIMIT environment variable. It can accept two types of values - string and long. String - just NO, when turns off maximum request body size check, and you can upload any size. If it is a long, it is the body size in bytes, the maximum size that can be loaded.

Have questions?

If you have a question - feel free to fill an issue, and i will answer you shortly as i can.

fileuploaderapp's People

Contributors

alexkuznetsov avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

fileuploaderapp's Issues

Add integration tests

Current tests are not enought and not covers all sides.
We should to add some integration tests

Update readme

It wolud be great to implove readme in sections:

  • building
  • testing
  • build status (azure pipelines)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.