Skip to content

Instantly share code, notes, and snippets.

@minodisk
Created December 22, 2017 14:48
Show Gist options
  • Save minodisk/cbb2f305884b82d5b22aaa9fc1e3239d to your computer and use it in GitHub Desktop.
Save minodisk/cbb2f305884b82d5b22aaa9fc1e3239d to your computer and use it in GitHub Desktop.

Revisions

  1. minodisk created this gist Dec 22, 2017.
    15 changes: 15 additions & 0 deletions example.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    import Client from "@minodisk/medkit";

    (async () => {
    const client = new Client();
    const postId = await client.createPost(
    "<h3>Title</h3><h4>Subtitle</h4><p>Text</p>",
    );
    const html = await client.readPost(postId); // -> "<h1>Title</h1><h2>Subtitle</h2><p>Text</p>" or "<h3>Title</h3><h4>Subtitle</h4><p>Text</p>"
    await client.updatePost(
    postId,
    "<h3>Title</h3><h4>Subtitle</h4><p>Modified</p>",
    );
    await client.destroyPost(postId);
    await client.close();
    })();