Coder Social home page Coder Social logo

fileuploader's Introduction

FileUploader

A Spring Boot application to manage files in cloud storage

General description

This application provide three endpoints: to upload a file, to download a file, and return the list of metadata of all stored files such as original name, size, and content type.

POST localhost:8080/upload
GET localhost:8080/download/<filename>
GET localhost:8080/

Connecting to AWS S3 bucket

In order to connect the application to an AWS S3 bucket one should set the following environmental variables.

export CLOUD_AWS_CREDENTIALS_ACCESSKEY=<access key>
export CLOUD_AWS_CREDENTIALS_SECRETKEY=<secret>
export CLOUD_AWS_REGION_STATIC=<region>
export AWS_S3_BUCKET_NAME=<bucket name>

Running the application

The application requires Java of at least version 8 to be installed. To run this application type the following command from the project's folder.

mvn spring-boot:run

General design considerations

This application uses a relational database to store file metadata. For simplicity, an in-memory database is used, but but simply changing connection URL one can connect to a RDMS such as MySQL or Postgres deployed locally or in the cloud.

A database is used to translate unique filename used for storage to original file names and also has better search capabilities than e.g. code relying on obtaining list of objects stored in the bucket.

Files are stored in an AWS S3 bucket. The original name of the file is returned using Content Disposition header. To save a file one can use the following cUrl command.

curl -O -L -J localhost:8080/download/<filename>

fileuploader's People

Contributors

javaeeeee avatar

Stargazers

Sascha Müller avatar

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.