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.
-
Module
spring-boot-restprovides the API backend for receiving tus file uploads:- Method
me.desair.spring.tus.App#tusFileUploadServicecreate aTusFileUploadServiceSpring bean based on the Spring Boot configuration that can be auto-wired into other beans. - The
me.desair.spring.tus.FileUploadControllerprovides the/api/uploadendpoint and passes all request directly to thatTusFileUploadServicebean. - Class
me.desair.spring.tus.client.UploadScriptis a script to upload a file using thetus-java-clientlibrary and can be ignored. - File
src/main/resources/public/index.htmlcontains the actual home page and loads the Uppy JavaScript file generated by theuppy-file-uploadmodule.
- Method
-
Module
uppy-file-uploadcontains the Webpack and Uppy configuration to fetch and join all required JavaScript files. This is not a production ready setup!- File
uppy-file-upload/app/uppy-fileupload.jscontains the configuration parameters of the Uppy tus JS client.
- File