Created
June 15, 2015 16:14
-
-
Save jazahn/1429a1072c04b51f9406 to your computer and use it in GitHub Desktop.
sample of ims-lti for node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var fs = require('fs'); | |
var express = require('express'); | |
var app = express(); | |
var lti = require('ims-lti'); | |
var ssl_options = { | |
key: fs.readFileSync(__dirname + '/ssl/localhost.key'), | |
cert: fs.readFileSync(__dirname + '/ssl/localhost.crt'), | |
requestCert: false, | |
rejectUnauthorized: false | |
}; | |
var consumer_key = "key"; | |
var consumer_secret = "secret"; | |
app.post('/launch_lti', function(req, res){ | |
var provider = new lti.Provider(consumer_key, consumer_secret); | |
provider.valid_request(req, function(err, isValid) { | |
console.log(err); | |
res.send("valid_request? " + isValid); | |
}); | |
}); | |
var server = https.createServer(ssl_options, app).listen(3001, function(){ | |
console.log("https server started at port 3001"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment