diff --git a/README.md b/README.md index 68cc50da..d34bd264 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,68 @@ # Discord-CDN cdn for discord clone -## Endpoints: - -### `/external` -#### POST +## Run localy: ``` +npm i +node dist/ +``` + +## Endpoints: +### POST `/attachments/` +``` +Content-Type: form-data + +attachment: File (binary-data) +``` +##### Returns: +``` +{ + "success": boolean, // true + "message": string, // "attachment uploaded" + "id": snowflake, // "794183329158135808" + "filename": string // "lakdoiauej.png" +} +``` +### GET `/attachments//` +``` +requests image from database with given and +``` +##### Returns: +``` +Content-Type: image/ +Image +``` +### DELETE `/attachments//` +``` +deletes database entry +``` +##### Returns: +``` +Content-Type: application/json + +{ + "success": true, + "message": "attachment deleted" +} +``` + +
+ +_(endpoints for crawler):_ +### POST `/external` + +``` +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" @@ -23,8 +72,8 @@ Content-Type: application/json "ogType": string // "website" } ``` -### `/external//` -#### GET +### GET `/external//` +- requests cached crawled image ``` url-params: :id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ==