Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 2.21 KB

README.md

File metadata and controls

60 lines (42 loc) · 2.21 KB

npm version JavaScript Style Guide tested with jest

Canvas LMS API for Node.js

Canvas API functions bundled as a NPM package for Node.js. Note: this package no longer supports CJS as of version 2.0.0. If you need CJS support, please use version 1.8.0.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for use with your own API tokens and Canvas domains.

Prerequisites

  1. Install Node LTS (20 or greater).

Installation

To use with NodeJS:

$ npm install node-canvas-api

Rename the sample.env file to .env and add your institution's domain and API access token.

Attached to the canvasAPI are a bunch of functions. Run the attached functions!

Example Usage

Get information about self:

import { getSelf } from 'node-canvas-api'

getSelf().then(x => console.log(x))

Get students in a course:

import { getUsersInCourse, getOptions } from 'node-canvas-api'

getUsersInCourse(12345, getOptions.users.enrollmentType.student) // first argument is Canvas course ID
  .then(students => console.log(students))

Contribute

Contributions are welcome and greatly appreciated!

How to contribute

  1. Create an issue describing what contribution you are planning to make.
  2. Fork the repo.
  3. Add your contributions.
  4. Once you're happy with your contribution, open an pull request and I'll take a look.

Usage

License

This project is licensed under the MIT License.