growi-js
v1.0.2
Published
This is a SDK for [GROWI](https://growi.org/) written in node.js.
Readme
Growi node.js SDK
This is a SDK for GROWI written in node.js.
Installation
$ npm install growi-jsUsage
Create a client
import { GROWI } from 'growi-js';
const growi = new GROWI({apiToken: 'YOUR_API_TOKEN'});Initialize parameters are as follows:
| Parameter | Description |
| --------- | ----------- |
| apiToken | API token for GROWI. You can get it from the setting page of GROWI. |
| url | URL of GROWI. Default is http://localhost:3000. |
| path | Endpoint path of Growi API. Default is /. |
Get root page
const page = await growi.root();
page instanceof growi.Page; // trueGet children of a page
const pages = await page.children();
pages[0] instanceof growi.Page; // trueUpdate page contents
page.contents('New contents');
await page.save();Get contents of a page
const contents = await page.contents();Create a page
const newPage = await page.create({name: 'New page'});Remove a page
await page.remove();License
MIT
