https://github.com/joeltadeu/dontfile-storage-service
https://github.com/joeltadeu/dontfile-storage-service
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/joeltadeu/dontfile-storage-service
- Owner: joeltadeu
- Created: 2024-01-29T01:56:55.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-29T01:58:20.000Z (over 1 year ago)
- Last Synced: 2025-02-25T00:34:01.342Z (8 months ago)
- Language: Java
- Size: 140 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DontFile Storage
A friend of mine had the brilliant idea to create a service for uploading files saving them in a popular site called dontpad.com as a string. I created a java version just for fun
Here a link for his repository:
[dontpad-storage](https://github.com/publi0/dontpad-storage)## Architecture
The following flow of the backend to upload and download the files:

## Endpoints
### Upload File
| EndPoint | Method | Description |
|----------------|:------:|------------------|
| /api/v1/files | POST | Upload new file |#### Example
````shell
curl --location 'http://localhost:8080/api/v1/files' \
--header 'Content-Type: application/pdf' \
--data '@book.pdf'
````
### Download File| EndPoint | Method | Description |
|--------------------|:------:|---------------------|
| /api/v1/files/{id} | GET | Download file by id |#### Example
````shell
curl --location 'http://localhost:8080/api/v1/files/1'
````### Get Files
| EndPoint | Method | Description |
|---------------|:------:|-------------------|
| /api/v1/files | GET | Get list of files |#### Example
````shell
curl --location 'http://localhost:8080/api/v1/files'
````#### Response
````json
[
{
"id": 1,
"uuid": "48677a0d-7de2-4635-bb09-3e30847940ce",
"createdAt": "2024-01-28T20:44:32.400978",
"name": "48677a0d-7de2-4635-bb09-3e30847940ce.pdf",
"url": "https://api.dontpad.com/48677a0d-7de2-4635-bb09-3e30847940ce",
"type": "application/pdf"
}
]
````## Documentation and Examples
### OpenApi
For the documentation of the APIs, access the link
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)### Postman collection

## Build & Run
### Local
```bash
mvn clean install
```
Run the command below to run the application.
```bash
java -jar dontfile-storage-service.jar
```### Docker
to build
```
docker build -f Dockerfile -t dontfile-storage-service:1.0.0 .
```to run as a container
```
docker run -d -p 8080:8080 -i -t dontfile-storage-service:1.0.0
```
### Port8080
## Stack
The following guides illustrate how to use some features concretely:
- Java 17
- H2 database
- Spring-Boot 3.2.2
- Feign Client