Skip to content

Commit

Permalink
Streamline README structure and update examples
Browse files Browse the repository at this point in the history
Removed redundant sections and clarified existing examples in the README. Adjusted route documentation for better clarity and consistency, removing unnecessary headers checks and redundant success bodies.
  • Loading branch information
NonSwag committed Sep 18, 2024
1 parent c3d1d35 commit 35e3517
Showing 1 changed file with 14 additions and 51 deletions.
65 changes: 14 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ java -jar $(find build/libs/ -name "*.jar" -print -quit)
```
data
├── config.json
├── database.db
└── schemataics
├── fe65d7edc37149c47171962dc26a039b
└── a98f299c5cf294e6555617e83226bcdd
└── database.db
```

`config.json` holds the user configuration data <br>
`database.db` holds the required data for each schematic <br>
`schematics` holds all schematic file data
~~`schematics` holds all schematic file data~~

### Routes

Expand Down Expand Up @@ -113,12 +110,12 @@ curl --location --request POST 'http://localhost:3000/upload' \

response:

| code | meaning |
|------|----------------------------------------------------------------------|
| 200 | file was of valid NBT format and was accepted |
| 400 | file was not of valid NBT format |
| 413 | file payload was too large and rejected |
| 500 | file could not be found on disk after being uploaded (upload failed) |
| code | meaning |
|------|-----------------------------------------------|
| 200 | file was of valid NBT format and was accepted |
| 400 | file was not of valid NBT format |
| 413 | file payload was too large and rejected |
| 500 | upload failed |

success body:

Expand Down Expand Up @@ -148,23 +145,12 @@ response:
| 200 | file was successfully renamed |
| 404 | file was not found in the database |

success body:

```json
{
"download_key": "db6186c8795740379d26fc61ecba1a24",
"delete_key": "11561161dffe4a1298992ce063be5ff9",
"expiration_date": 1717940582741
}
```

### Check download headers
### Download a file

**HEAD `INSTANCE_URL/download/:download_key`**: check what headers you'd get if you sent a POST request for a file with
the given download_key; example:
**GET `INSTANCE_URL/download/:download_key`**: download a file with the given `download_key`; example:

```sh
curl --location --head 'http://localhost:3000/download/db6186c8795740379d26fc61ecba1a24'
curl --location --request GET 'http://localhost:3000/download/db6186c8795740379d26fc61ecba1a24'
```

The response for this is in the form of status codes only.
Expand All @@ -176,26 +162,14 @@ The response for this is in the form of status codes only.
| 410 | File metadata is in accounting table, but file is not on disk or already expired |
| 500 | An internal server error occurred due to corrupted metadata (missing data in database) |

### Download a file

**GET `INSTANCE_URL/download/:download_key`**: download a file with the given `download_key`; example:

```sh
curl --location --request GET 'http://localhost:3000/download/db6186c8795740379d26fc61ecba1a24'
```

response:
see **Check download headers** above.

On success, the file is sent as an attachment for download to the browser / requester.

### Check deletion headers
### Delete a file

**HEAD `INSTANCE_URL/delete/:delete_key`**: check what headers you'd get if you sent a DELETE request for a file with
the given delete_key; example:
**DELETE `PUBLIC_URL/delete/:delete_key`**: delete a file with the given `delete_key`; example:

```sh
curl --location --head 'http://localhost:3000/delete/11561161dffe4a1298992ce063be5ff9'
curl --location --request DELETE 'http://localhost:3000/delete/11561161dffe4a1298992ce063be5ff9'
```

The response for this is in the form of status codes only.
Expand All @@ -207,15 +181,4 @@ The response for this is in the form of status codes only.
| 410 | File metadata is in accounting table, but file is not on disk or already expired |
| 500 | An internal server error occurred due to corrupted metadata (missing data in database) |

### Delete a file

**DELETE `PUBLIC_URL/delete/:delete_key`**: delete a file with the given `delete_key`; example:

```sh
curl --location --request DELETE 'http://localhost:3000/delete/11561161dffe4a1298992ce063be5ff9'
```

response:
see **Check deletion headers** above.

On success, the file is deleted and the record is marked as expired in the database.

0 comments on commit 35e3517

Please sign in to comment.