UNPKG

6.5 kBMarkdownView Raw
1<div align="center">
2 <br>
3 <br>
4 <a href="https://cvmcosta.github.io/ltijs"><img width="360" src="https://raw.githubusercontent.com/Cvmcosta/ltijs/987de79b9a3d529b1b507baa7b7a95d32ab386c2/docs/logo-300.svg?sanitize=true"></img></a>
5</div>
6
7
8
9> Turn your application into a fully integratable LTI 1.3 tool provider or consumer.
10
11
12[![travisci](https://img.shields.io/travis/cvmcosta/ltijs.svg)](https://travis-ci.org/Cvmcosta/ltijs)
13[![codecov](https://codecov.io/gh/Cvmcosta/ltijs/branch/master/graph/badge.svg)](https://codecov.io/gh/Cvmcosta/ltijs)
14[![Node Version](https://img.shields.io/node/v/ltijs.svg)](https://www.npmjs.com/package/ltijs)
15[![NPM package](https://img.shields.io/npm/v/ltijs.svg)](https://www.npmjs.com/package/ltijs)
16[![NPM downloads](https://img.shields.io/npm/dm/ltijs)](https://www.npmjs.com/package/ltijs)
17[![dependencies Status](https://david-dm.org/cvmcosta/ltijs/status.svg)](https://david-dm.org/cvmcosta/ltijs)
18[![devDependencies Status](https://david-dm.org/cvmcosta/ltijs/dev-status.svg)](https://david-dm.org/cvmcosta/ltijs?type=dev)
19[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
20[![APACHE2 License](https://img.shields.io/github/license/cvmcosta/ltijs)](LICENSE)
21[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffe-blue)](https://www.buymeacoffee.com/UL5fBsi)
22
23
24> v2.0.0
25>BREAKING CHANGES
26> - New authentication system, now uses a query parameter 'ltik', to pass the ltijs key to the application instead of embedding it into the path.
27> - As a result, simplified routing, without needing to account for the context path.
28> - Silent option added to the deploy method, that supresses the initial console logs.
29> - Ltijs now works with Postgresql database via the ltijs-postgresql plugin.
30> - Fixed staticPath option where it used to disable the invalidToken route if some index.html was present in the given path.
31> - Graceful shutdown added, closing connection to databases.
32
33> - View entire [CHANGELOG](https://cvmcosta.github.io/ltijs/#/changelog)
34
35
36
37## Table of Contents
38
39- [Introduction](#introduction)
40- [Installation](#installation)
41- [Features](#features)
42- [Usage](#usage)
43- [Documentation](#documentation)
44- [Contributing](#contributing)
45- [License](#license)
46
47
48---
49## Introduction
50According to the [IMS Global Learning Consortium](https://www.imsglobal.org/), the Learning Tools Interoperability (LTI) protocol is an IMS standard for integration of rich learning applications within educational environments. <sup>[ref](https://www.imsglobal.org/spec/lti/v1p3/)</sup>
51
52
53This package implements a tool provider and consumer (currently in development) as an [Express](https://expressjs.com/) server, with preconfigured routes and methods that manage the [LTI 1.3](https://www.imsglobal.org/spec/lti/v1p3/) protocol for you. Making it fast and simple to create a working learning tool without having to worry about manually implementing any of the security and validation required to do so.
54
55
56---
57
58
59## Installation
60
61### Installing the package
62
63```shell
64$ npm install ltijs
65```
66### MongoDB
67- This package uses mongoDB to store and manage the server data, so you need to have it installed, see link bellow for further instructions.
68[Installing mongoDB](https://docs.mongodb.com/manual/administration/install-community/)
69
70### PostgreSQL
71- This package can also use PosgreSQL to store and manage the server data, it does so through the plugin [ltijs-postgresql](https://www.npmjs.com/package/ltijs-postgresql).
72
73
74
75---
76
77## Features
78
79| Feature | Implementation | Documentation |
80| --------- | - | - |
81| Provider | <center>:heavy_check_mark:</center> | <center>:heavy_check_mark:</center> |
82| [Platform Class](https://cvmcosta.github.io/ltijs/#/platform) | <center>:heavy_check_mark:</center> | <center>:heavy_check_mark:</center> |
83| Database plugins | <center>:heavy_check_mark:</center> | <center>:heavy_check_mark:</center> |
84| Grade Service Class | <center>:heavy_check_mark:</center> | <center></center> |
85| Keyset endpoint support | <center></center> | <center></center> |
86| Redis caching | <center></center> | <center></center> |
87| Names and Roles Service Class | <center></center> | <center></center> |
88
89
90
91
92This package implements LTI Provider and Consumer servers. See bellow for specific documentations.
93
94### [LTIjs Provider Documentation](https://cvmcosta.github.io/ltijs/#/provider)
95 - [Platform class documentation](https://cvmcosta.github.io/ltijs/#/platform)
96
97### ~~LTIjs Consumer Documentation~~ (Coming soon)
98
99---
100
101## Usage
102
103### Example of provider usage
104
105> Update and install this package first
106
107```shell
108$ npm install ltijs
109```
110
111> Install mongoDB
112
113 - [Installing mongoDB](https://docs.mongodb.com/manual/administration/install-community/)
114
115
116> Instantiate and use Provider class
117
118
119
120```javascript
121const path = require('path')
122
123// Require Provider
124const LTI = require('ltijs').Provider
125
126// Configure provider
127const lti = new LTI('EXAMPLEKEY',
128 { url: 'mongodb://localhost/database' },
129 { appUrl: '/', loginUrl: '/login', logger: true })
130
131
132let setup = async () => {
133 // Deploy and open connection to the database
134 await lti.deploy()
135
136 // Register platform
137 let plat = await lti.registerPlatform({
138 url: 'https://platform.url',
139 name: 'Platform Name',
140 clientId: 'TOOLCLIENTID',
141 authenticationEndpoint: 'https://platform.url/auth',
142 accesstokenEndpoint: 'https://platform.url/token',
143 authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset' }
144})
145
146 // Set connection callback
147 lti.onConnect((connection, request, response) => {
148 // Call redirect function
149 lti.redirect(response, '/main')
150 })
151
152 // Set main endpoint route
153 lti.app.get('/main', (req, res) => {
154 // Id token
155 console.log(res.locals.token)
156 res.send('It\'s alive!')
157 })
158}
159setup()
160```
161
162---
163
164## Documentation
165You can find the project documentation [here](https://cvmcosta.github.io/ltijs).
166
167---
168
169## Contributing
170
171
172If you find a bug or think that something is hard to understand feel free to open an issue or contact me on twitter [@cvmcosta](https://twitter.com/cvmcosta), pull requests are also welcome :)
173
174
175And if you feel like it, you can donate any amount of money through paypal, it helps a lot.
176
177[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffe-blue)](https://www.buymeacoffee.com/UL5fBsi)
178
179
180
181---
182
183## License
184
185[![APACHE2 License](https://img.shields.io/github/license/cvmcosta/ltijs)](LICENSE)
186