@forefront/parse-server-cos-adapter
v1.1.0
Published
Tecent Cloud COS(file storage) adapter for parse-server
Downloads
4
Maintainers
Readme
parse-server-cos-adapter
Tecent Cloud COS(file storage) adapter for parse-server
parse-server adapter for Tecent COS
installation
npm install --save @forefront/parse-server-cos-adapter
usage with parse-server
using a config file
{
"appId": 'my_app_id',
"masterKey": 'my_master_key',
// other options
"filesAdapter": {
"module": "@forefront/parse-server-cos-adapter",
"options": {
"SecretId": "SecretId",
"SecretKey": "SecretKey",
"Region": "my_region",
"Bucket": "my_bucket",
"Signed": false // default value
// optional:
"directAccess": false // default value
}
}
}
using environment variables
Set your environment variables:
COS_SECRET_ID=SecretId
COS_SECRET_KEY=SecretKey
COS_REGION=regionName
COS_BUCKET=bucketName
COS_SIGNED=false
COS_DIRECT_ACCESS=false
And update your config / options
{
"appId": 'my_app_id',
"masterKey": 'my_master_key',
// other options
"filesAdapter": "@forefront/parse-server-cos-adapter"
}
passing as an instance
var COSAdapter = require('@forefront/parse-server-cos-adapter');
var cosAdapter = new COSAdapter(
'SecretId',
'SecretKey',
'Region',
'Bucket',
false,
{
directAccess: false
}
);
var api = new ParseServer({
appId: 'my_app',
masterKey: 'master_key',
filesAdapter: cosAdapter
})
or with an options hash
var COSAdapter = require('@forefront/parse-server-cos-adapter');
var cosOptions = {
"SecretId": "SecretId",
"SecretKey": "SecretKey",
"Region": "my_region",
"Bucket": "my_bucket",
"Signed": false,
"DirectAccess": false
}
var cosAdapter = new COSAdapter(cosOptions);
var api = new ParseServer({
appId: 'my_app',
masterKey: 'master_key',
filesAdapter: cosAdapter
})