node-canvas-api
v2.0.0
Published
Canvas LMS API for Node
Downloads
332
Maintainers
Readme
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
- 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
- Create an issue describing what contribution you are planning to make.
- Fork the repo.
- Add your contributions.
- 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.