Package Exports
- microcms-js-sdk
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (microcms-js-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
microCMS JavaScript SDK
It helps you to use microCMS from JavaScript and Node.js applications.
Getting Started
Install
Install npm package.
$ npm install microcms-js-sdk
or
$ yarn add microcms-js-sdk
CDN
https://unpkg.com/microcms/client
Hot to use
First, create a client.
const { Client } = require("microcms-js-sdk"); // CommonJS
import { Client } from 'microcms-js-sdk'; //ES6
// Initialize Client SDK.
const client = Client({
serviceDomain: "YOUR_DOMAIN",
apiKey: "YOUR_API_KEY",
globalDraftKey: "YOUR_GLOBAL_DRAFT_KEY", // If need
});
After, How to use it below.
client
.get({
endpoint: 'endpoint',
queries: { limit: 20, filters: 'createdAt[greater_than]2021' },
})
.then((res) => console.log(res))
.catch((err) => console.log(err));
client
.get({
endpoint: 'endpoint',
contentId: 'contentId',
queries: { limit: 20, filters: 'createdAt[greater_than]2021' },
})
.then((res) => console.log(res))
.catch((err) => console.log(err));
LICENSE
Apache-2.0