Skip to content

Commit

Permalink
README Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelumetta authored Nov 10, 2017
1 parent 7a97c4e commit af053f9
Showing 1 changed file with 31 additions and 40 deletions.
71 changes: 31 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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:
Expand Down

0 comments on commit af053f9

Please sign in to comment.