. .
-
Clone the repository in your local computer
-
Go to the root directory
-
Run npm install (be sure that you have npm and node installed in your pc)
-
Create an
.env
file and put the information according to.env.example
-
Now Run
npm run start:dev
. .
#Configurable Options
FOLDER="uploads"
PORT=3100
TIMEZONE="Asia/Dhaka"
DOWNLOAD_LIMIT=5 #chose any intiger number
DOWNLOAD_LIMIT_DURATION="1MIN"
JWT_SECRET="anyarbitratrylongtext"
#DB Settings
DATABASE_HOST="yourdbhost"
DATABASE_PORT=3306 #we are using mysql
DATABASE_USER="yourdbuser"
DATABASE_PASSWORD="yourdbpassword"
DATABASE_NAME="yourdbname"
#AWS settings
AWS_ACCESS_KEY="aws_access_key"
AWS_SECRET_ACCESS="aws_secret_access"
AWS_PUBLIC_BUCKET_NAME='public bucket name including subfolder'
AWS_ELASTICACHE_ENDPOINT="aws elasticache endpoint"
. . .
. . .
Endpoint: /files
Method: POST
Request Body (form data):
key | value |
---|---|
storage_location | onserver or cloud |
file | select file from your machine |
Response Body (sample):
{
"publickey": "688a81cc7afb9709",
"privatekey": "52682f7de378f4b8"
}
. . .
Endpoint: /filesRSA
Method: POST
Request Body (form data):
key | value |
---|---|
storage_location | onserver or cloud |
file | select file from your machine |
Response Body (sample):
{
"publickey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2JT1X7RF2MBPHJh5JiHwXkUMO91tTvzPCcLD31ejqkJhnaY7cMs77YcB6D5sujkxuVpqUOs6IGXtoIuDmWnnTVwugV3wTsgcM3UyipKueMGkwZbHw0l4MzBkyxFvDa8Wmk1f+yLxLkHZgJJsK5IjSLoMZ66niwZ2wwWNlGPkMhJbN/iNOEP8H80si3JTkxQ5d1skqB79iRThlSLjScr+L1ylVF81rUmLdrEeGZ9gzzw5sI84kfsazCsKB1i2c8iD7SIprXqAfgpSo9J7olHOIIZUtZ6DrUewc+hCo9wAo/D9SE32ZVbmzpqNCuClMOYR7BN4L/d60WeAHjlDM0adsQIDAQAB",
"privatekey": "MIIEvQIBADAN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OkHccjI4bQi7HEvwKBgCE+Hl+NFA8i/1g66nhq+pq+r/6vBUfQN3DXcROsV4tcn259hiEEGXAcq+m7B/GlA8+vNS4eciTcckPwviGDvM3857e3MBZ8teSXXOBL6GTJxu0RaTN0C8fsV93Ud9oCIiGOHLSPRHK8zTGhKwss7WpAygVQsZczt/doHpIxLTKnAoGARVbN1R63uswxstLjECjlcgoNwfwpVjej+ZT/lVKO0Jwznz3+44QYTPgruDI+7ogbJiQYU0qOCXPMkMwpfVrt0Cbv0pQZaAMBU/dK4VWVKw535YbZ8mqRGSdfCSpb0BuACOoD46wFdAIyjT+3cHRf2bcofvJw0XcfNK/QdHAMzC0CgYEAqRvHtGqRZeytsZvoQKmPj0xFpgz1r4V5OGBgffrWfPshOSvAqC4LIYV86EdPaXZ+6Ul+3R/6cEhI38QEy87NiQGyk4h16dNb0gYj2EVfx02Xbed3mdq/+ChfGbt6VuXK9M5av90LSGhzo1/A7AG3rw9HXZdbnc01dJY5M1xdA7s="
}
. . .
Endpoint: /files/:publickey
Method: GET
Response Body (sample):
Note: If you want to provide an RSA public key in the url path it must need to be url encoded. You can encode it online from this site: https://www.urlencoder.io/
The file will be downloaded automatically
. . .
Endpoint: /files/:privatekey
Method: DELETE
Response Body (sample):
File deletion with RSA private key has some problem as of now. So I recommend always use Simple KeyPair while uploading as there is no encryption happening inside the code**
{
"status_code": 200,
"message": "File has successfully been deleted!"
}