Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 1.66 KB

README.md

File metadata and controls

23 lines (18 loc) · 1.66 KB

tus-java-server-spring-demo

Tus java server demo using Spring Boot that uses the tus-java-server library and the Uppy file uploader in order to easily provide asynchronous and resumable file uploads in Spring.

To build and run this demo, execute the following commands:

$ git clone https://github.com/tomdesair/tus-java-server-spring-demo.git
$ cd tus-java-server-spring-demo
$ mvn clean package
$ java -jar spring-boot-rest/target/spring-boot-rest-0.0.1-SNAPSHOT.jar

Then visit http://localhost:8080/test/ in your browser and try to upload a file using the Uppy file uploader.

Que?

  • Module spring-boot-rest provides the API backend for receiving tus file uploads:

    1. Method me.desair.spring.tus.App#tusFileUploadService create a TusFileUploadService Spring bean based on the Spring Boot configuration that can be auto-wired into other beans.
    2. The me.desair.spring.tus.FileUploadController provides the /api/upload endpoint and passes all request directly to that TusFileUploadService bean.
    3. Class me.desair.spring.tus.client.UploadScript is a script to upload a file using the tus-java-client library and can be ignored.
    4. File src/main/resources/public/index.html contains the actual home page and loads the Uppy JavaScript file generated by the uppy-file-upload module.
  • Module uppy-file-upload contains the Webpack and Uppy configuration to fetch and join all required JavaScript files. This is not a production ready setup!

    1. File uppy-file-upload/app/uppy-fileupload.js contains the configuration parameters of the Uppy tus JS client.