Update README.md

This commit is contained in:
xnacly 2020-12-31 13:54:40 +01:00 committed by GitHub
parent 631a1d80a0
commit f1d63918ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,18 +2,64 @@
cdn for discord clone
## Endpoints:
### `/attachments/<filename>`
#### POST
```
Content-Type: form-data
attachment: File
```
##### Returns:
```
{
"success": boolean, // true
"message": string, // "attachment uploaded"
"id": snowflake, // "794183329158135808"
"filename": string // "lakdoiauej.png"
}
```
### `/attachments/<id>/<filename>`
#### GET
```
requests image from database with given <id> and <filename>
```
##### Returns:
```
Content-Type: image/<imageType(png,img,gif)>
Image
```
### `/attachments/<id>/<filename>`
#### DELETE
```
deletes database entry
```
##### Returns:
```
Content-Type: application/json
{
"success": true,
"message": "attachment deleted"
}
```
<hr>
_(endpoints for crawler):_
### `/external`
#### POST
```
requests crawling of `og:`metadata and the download of the `og:image` property
--------
Content-Type: application/json
body:
{"url": URL} // "https://discord.com"
```
##### Returns:
```
Content-Type: application/json
```ts
{
"id": string, // "aHR0cHM6Ly9kaXNjb3JkLmNvbQ=="
"ogTitle": string, // "Discord | Your Place to Talk and Hang Out"
@ -25,6 +71,7 @@ Content-Type: application/json
```
### `/external/<id>/<filename>`
#### GET
- requests cached crawled image
```
url-params:
:id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ==