diff --git a/README.md b/README.md index aa52b60..a90db40 100644 --- a/README.md +++ b/README.md @@ -50,54 +50,24 @@ Every resource method returns a promise: butter.post.list({page: 1, page_size: 10}).then(function(response) { console.log(response) }) - -// Get blog post -butter.post.retrieve("hello-world").then(function(response) { - console.log(response) -}) - -// Get homepage content -butter.content.retrieve(["home"]).then(function(resp) { - console.log(resp) -}); - -// Get pages -butter.content.retrieve(["pages"]).then(function(resp) { - console.log(resp) -}); ``` -See our [node app](https://github.com/buttercms/nodejs-cms-express-blog) for a full example. +## Pages -## Available resources & methods +Where you see params it is a plain js object, e.g. `{page: 1}`. For a list of params see the [API documentation](https://buttercms.com/docs/api/) -Where you see params it is a plain js object, e.g. `{page: 1}` - -* post - * `retrieve(slug[, params])` - * `list([params])` - * `search(query[, params])` -* category - * `retrieve(slug[, params])` - * `list([params])` -* tag - * `retrieve(slug[, params])` - * `list([params])` -* author - * `retrieve(slug[, params])` - * `list([params])` -* feed - * `retrieve(type[, params])` -* content - * `retrieve(keys)` * page * `retrieve(page_type, page_slug[, params])` * `list(page_type[, params])` -## Localization +## Content fields -Setup locales in the ButterCMS dashboard and fetch localized content using the locale option: +* content + * `retrieve(keys)` + +### Localization +Setup locales in the ButterCMS dashboard and fetch localized content using the locale option: ```js // Get pages @@ -106,9 +76,9 @@ butter.content.retrieve(["pages"], {locale: 'es'}).then(function(resp) { }); ``` -## Test mode +### Test mode -Test mode can be used to setup a staging website for previewing content or for testing content during local development. To fetch content from test mode add an additional argument, `true`, to the package initialization: +Test mode can be used to setup a staging website for previewing content fields or for testing content during local development. To fetch content from test mode add an additional argument, `true`, to the package initialization: ```js var butter = require('buttercms')('your butter API token', true); @@ -120,6 +90,27 @@ Or use an environment variable: var butter = require('buttercms')('your butter API token', process.env.BUTTER_TEST_MODE); ``` +## Blog Engine + +* post + * `retrieve(slug[, params])` + * `list([params])` + * `search(query[, params])` +* category + * `retrieve(slug[, params])` + * `list([params])` +* tag + * `retrieve(slug[, params])` + * `list([params])` +* author + * `retrieve(slug[, params])` + * `list([params])` +* feed + * `retrieve(type[, params])` + +See our [node app](https://github.com/buttercms/nodejs-cms-express-blog) for a full example. + + ## Timeouts The default timeout threshold is 3000ms but you can change it: