Api codebase of bitcdn
-
clone this repo
-
install dependencies
-
create
.envfile, eg.
APIURL=bitcdn.host
PORT=7556
NODE_ENV=production
TRUST_PROXY=true
KEYS=[{"dir":"rootfolder","suburl":"f","uuid":"6408bf6b-9db1-4f58-9363-3a10aa428940"}]
- start the app
node index.js
/upload - [POST] => [JSON]
-
Body Parameters
-
tokenthe token for authentication -
datathe datauri with format ofdata:...mimetype;base64,...base64data -
filepaththe filepath to save the file eg.js/myjs.js
-
-
Query Parameters [Optional]
-
convertto convert the image to specified format. Allowed values are eitherjpg,jpeg,pngorwebp -
optimizedAdding this query will return two images in an Object format.{original,optimized} -
originalis the original uploaded image -
optimizedis the optimizedwebpimage
-
-
returns => [JSON]
-
success=> [BOOLEAN] -
data=> [STRING|OBJECT] - the url for the uploaded file
-
/uploadurl - [POST] => [JSON]
-
Body Parameters
-
tokenthe token for authentication -
urlthe url of the file to upload, the url must respond with cors headers enabled
-
-
Query Parameters [Optional]
-
convertto convert the image to specified format. Allowed values are eitherjpg,jpeg,pngorwebp -
optimizedAdding this query will return two images in an Object format.{original,optimized} -
originalis the original uploaded image -
optimizedis the optimizedwebpimage
-
-
returns => [JSON]
-
success=> [BOOLEAN] -
data=> [STRING|OBJECT] - the url for the uploaded file
-
/deleteimage - [POST] => [JSON]
-
Body Parameters
-
tokenthe token for authentication -
filenamethe filename with out the extenstion.
-
-
returns => [JSON]
success=> [BOOLEAN]