Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
exacs committed Feb 8, 2021
1 parent 23cda3e commit f3a53ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ npm i @kth/canvas-api
## Usage

```js
import CanvasApi from '@kth/canvas-api'
import CanvasApi from "@kth/canvas-api";
// or, with CommonJS:
// const CanvasApi = require("@kth/canvas-api");

async function start() {
const canvas = new CanvasApi("https://kth.instructure.com/api/v1", "XXXX~xxxx");
const canvas = new CanvasApi(
"https://kth.instructure.com/api/v1",
"XXXX~xxxx"
);
const { body } = await canvas.get("/accounts/1");
}

Expand All @@ -34,7 +37,7 @@ start();
### Create a course

```js
import CanvasApi from '@kth/canvas-api'
import CanvasApi from "@kth/canvas-api";
const canvas = new CanvasApi("https://kth.instructure.com/api/v1", "XXXX~xxxx");

async function start() {
Expand All @@ -53,7 +56,7 @@ start();
It is easier to use an array if you want to use JavaScript array methods (map, filter, etc.), when you want to retrieve the entire collection or when you know that the collection has a small size.

```js
import CanvasApi from '@kth/canvas-api'
import CanvasApi from "@kth/canvas-api";

const courseId = "XXXX";
const canvas = new CanvasApi("https://kth.instructure.com/api/v1", "XXXX~xxxx");
Expand All @@ -73,7 +76,7 @@ start();
It is better to use an iterable if you don't want to fetch all the resources in a collection (in this case we are interested in **5 courses that...**)

```js
import CanvasApi from '@kth/canvas-api'
import CanvasApi from "@kth/canvas-api";
const canvas = new CanvasApi("https://kth.instructure.com/api/v1", "XXXX~xxxx");

function isSustainable(course) {
Expand Down

0 comments on commit f3a53ab

Please sign in to comment.