Created
April 27, 2017 13:39
-
-
Save stefanoverna/f94da8669ad0a24c8006521741a9532e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Dato = require('datocms-client'); | |
| var Loader = require('datocms-client/lib/local/Loader'); | |
| const client = new Dato.SiteClient('XXX'); | |
| const loader = new Loader(client); | |
| loader.load().then(() => { | |
| const dato = loader.itemsRepo; | |
| // ok, now "dato" exposes everything contained in the space with a friendly API: | |
| // you can use method chains to navigate deeply across your records’ relationships... | |
| dato.blogPosts[0].authors[0].firstName; | |
| // offer higher-level methods for specific fields... | |
| dato.blogPosts[0].coverImage.url({ w: 800, h: 600, fm: 'jpg' }) | |
| // and pretty much everything that's covered in our documentation: https://docs.datocms.com/other/overview.html | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment