Node.js driver for HashBrown CMS
A tool for easily accessing your HashBrown CMS content data on your site
Usage
$ npm install hashbrown-driver
const HashBrown = require('hashbrown-driver');
Example project
Check out the example project
API
The helper classes are accessed thusly:
HashBrown.content // ContentHelper
HashBrown.media // MediaHelper
HashBrown.forms // FormsHelper
HashBrown.templates // TemplateHelper
ContentHelper
A helper class for fetching content
Kind: global class
-
ContentHelper
-
.getTree(updateCache) ⇒
Promise
-
.setTree(json) ⇒
Promise
-
.getById(id) ⇒
Promise
-
.getByUrl(url) ⇒
Promise
-
.deleteById(id) ⇒
Promise
-
.setById(id, content) ⇒
Promise
-
.setPropertiesById(id, properties, language, meta) ⇒
Promise
-
.getPropertiesById(id, language) ⇒
Promise
-
.getTree(updateCache) ⇒
ContentHelper.getTree(updateCache) ⇒ Promise
Gets the entire content tree
Kind: static method of ContentHelper
Returns: Promise
- Object
Param | Type | Default |
---|---|---|
updateCache | Boolean |
false |
ContentHelper.setTree(json) ⇒ Promise
Saves the JSON tree
Kind: static method of ContentHelper
Returns: Promise
- promise
Param | Type |
---|---|
json | Object |
ContentHelper.getById(id) ⇒ Promise
Gets a content node by id
Kind: static method of ContentHelper
Returns: Promise
- Content
Param | Type |
---|---|
id | String |
ContentHelper.getByUrl(url) ⇒ Promise
Gets a content node by url
Kind: static method of ContentHelper
Returns: Promise
- Content
Param | Type |
---|---|
url | String |
ContentHelper.deleteById(id) ⇒ Promise
Delete a content node by id
Kind: static method of ContentHelper
Returns: Promise
- Result
Param | Type |
---|---|
id | String |
ContentHelper.setById(id, content) ⇒ Promise
Sets a content node by id
Kind: static method of ContentHelper
Returns: Promise
- Content
Param | Type |
---|---|
id | String |
content | Object |
ContentHelper.setPropertiesById(id, properties, language, meta) ⇒ Promise
Sets content node properties by id
Kind: static method of ContentHelper
Returns: Promise
- Content
Param | Type |
---|---|
id | String |
properties | Object |
language | String |
meta | Object |
ContentHelper.getPropertiesById(id, language) ⇒ Promise
Gets content node properties by id
Kind: static method of ContentHelper
Returns: Promise
- Content
Param | Type |
---|---|
id | String |
language | String |
FormsHelper
A helpers class for processing forms
FormsHelper.postEntry(id, query) ⇒ Promise
Submits an entry
Kind: static method of FormsHelper
Returns: Promise
- Result
Param | Type |
---|---|
id | String |
query | Object |
TemplateHelper
A helper class for fetching templates
Kind: global class
-
TemplateHelper
-
.get(type, name) ⇒
Promise
-
.getAll(type) ⇒
Promise
-
.get(type, name) ⇒
TemplateHelper.get(type, name) ⇒ Promise
Gets a Template by name
Kind: static method of TemplateHelper
Returns: Promise
- Template
Param | Type |
---|---|
type | String |
name | String |
TemplateHelper.getAll(type) ⇒ Promise
Gets all template objects
Kind: static method of TemplateHelper
Returns: Promise
- Template
Param | Type |
---|---|
type | String |