Cosmic JS Client for the browser
Getting started
Go to https://cosmicjs.com, create an account and setup a bucket.
Install
npm install cosmicjs-browser
Usage
/* Configure================================ */var config = {};configbucket = slug: 'client-example' read_key: '' // add read_key if added to your Cosmic JS bucket settings write_key: '' // add write_key if added to your Cosmic JS bucket settings; /* Get bucket================================ */Cosmic; /* Get objects================================ */Cosmic; /* Get media================================ */Cosmic; /* Add object================================ */var object = "write_key": configbucketwrite_key "type_slug": "pages" "title": "Test Title" "content": "Test Content"; Cosmic; /* Edit object================================ */var object = "write_key": configbucketwrite_key "slug": "test-title" "type_slug": "pages" "title": "New Title" "content": "New Content"; Cosmic; /* Delete object================================ */var object = "write_key": configbucketwrite_key "slug": "test-title"; Cosmic;