graphcms-js

EXPERIMENTAL - NOT AN OFFICIAL GRAPHCMS LIBRARY

Usage no npm install needed!

<script type="module">
  import graphcmsJs from 'https://cdn.skypack.dev/graphcms-js';
</script>

README

EXPERIMENTAL - NOT AN OFFICIAL GRAPHCMS LIBRARY

graphcms-js

JSON to GraphCMS request handler

Quickstart

const { GraphCMS } = require("graphcms-js");

const api = new GraphCMS("<endpoint>", {
  token: "<optional-auth-token>",
});

api
  .model("posts")
  .select({ id: true, title: true })
  .exec()
  .then(console.log)
  .catch(console.log);

api
  .model("post")
  .where({ id: "ckfdy1so000sx0107hyg1o9k0" })
  .select({ id: true, title: true, authors: { id: true, name: true } })
  .exec()
  .then(console.log)
  .catch(console.log);