@kolach/loopback-component-cloudinary

Cloudinary connector for loopback

Stats

StarsIssuesVersionUpdatedCreatedSize
@kolach/loopback-component-cloudinary
410.0.36 years ago6 years agoMinified + gzip package size for @kolach/loopback-component-cloudinary in KB

Readme

Loopback Component Cloudinary

Circle CI

A small loopback component that acts as a cloudinary datasource. Only image upload is supported is supported currently.

Installation and Usage

npm install loopback-component-cloudinary

Generate an image model:

image.js

module.exports = function(Image) {
};

image.json

{
  "name": "Image",
  "plural": "images",
  "base": "Model",
  "options": {},
  "properties": {},
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}

Add cloudinary datasource

datasource.json

{
  "cloudinary": {
    "name": "cloudinary",
    "connector": "@kolach/loopback-component-cloudinary"
        "config": {
            "cloud_name": "your_cloud_name",
            "api_key": "your_api_key",
            "api_secret": "your_api_secret"
        }
  }
}

Optionally define upload default parameters:

{
  "cloudinary": {
    "name": "cloudinary",
    "connector": "@kolach/loopback-component-cloudinary"
        "config": {
            "cloud_name": "your_cloud_name",
            "api_key": "your_api_key",
            "api_secret": "your_api_secret"
        },
        "upload": {
            "tags": "staging, flickr",
            "folder": "important"
        }
  }
}

This configuration will automatically add staging and flickr tags, and setup root folder as important

Connect Image model to cloudany datasource

model.config.json

{
  ...
  "Image": {
    "dataSource": "cloudinary",
    "public": true
  }
}

The configuration above will add POST ${restApiRoot}/images/upload url.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.