Following code is throwing a syntax error in node v10.15.3
var lti = require('library name');
var provider = lti.somemethod(some arguments)
// following line throw syntax error
provider.valid_request req, (err, isValid) ->
Following code is throwing a syntax error in node v10.15.3
var lti = require('library name');
var provider = lti.somemethod(some arguments)
// following line throw syntax error
provider.valid_request req, (err, isValid) ->
Normal Javascript Syntax
function myFunc(arg1, arg2, arg3){
// Func logic here
}
This function can be rewritten in ES6 syntax as following
const myFunc = (arg1, arg2, arg3) => {
// Func Logic Here
}
I Assume that in your question, provider.valid_request is a function which takes in a callback function as an argument.
so you can write it as
provider.valid_request(req, (err, isValid) => {
if(!err && isValid){
// logic here
}
})