Skip to content

A boilerplate starter project for building a Java Spring Boot application with File Storage Service.

License

Notifications You must be signed in to change notification settings

boilerlabs/java-spring-service-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Java Spring Boot File Storage

License Issues Stars

A boilerplate starter project for building a Java Spring Boot application with File Storage Service. This template includes essential features for implementing a simple file storage service.

Table of Contents

  1. Features
  2. Getting Started
  3. Usage
  4. Contributing
  5. License

Features

  • File Storage Service
  • File Upload
  • File Download
  • File Deletion
  • File Metadata
  • List Files with Pagination
  • Swagger UI
  • Logging with Logback
  • Docker Compose for MySQL and Adminer

Getting Started

Prerequisites

  • Java 17+
  • Maven

Installation

  1. Clone the repository:
git clone https://github.com/boboilerlabs/java-spring-file-storage
cd java-spring-file-storage
  1. Running with Maven
mvn spring-boot:run
  1. Using Swagger UI

Visit http://localhost:8080/swagger-ui.html to access the Swagger UI and try out the API endpoints.

Usage

Upload File

To upload a file, send a POST request to /api/files/upload with the file as a form-data:

curl -X POST "http://localhost:8080/api/files/upload" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/path/to/your/file.txt"

Download File

To download a file, send a GET request to /api/files/download/{fileId}:

curl -X GET "http://localhost:8080/api/files/download/{fileId}" -o downloaded_file.txt

Delete File

To delete a file, send a DELETE request to /api/files/delete/{fileId}:

curl -X DELETE "http://localhost:8080/api/files/delete/{fileId}"

List Files

To list all files, send a GET request to /api/files:

curl -X GET "http://localhost:8080/api/files?page=0&size=10"

Get File Metadata

To get the metadata of a file, send a GET request to /api/files/{fileId}:

curl -X GET "http://localhost:8080/api/files/{fileId}"

Contributing

We welcome contributions! Please see the CONTRIBUTING.md for more details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A boilerplate starter project for building a Java Spring Boot application with File Storage Service.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages