nl_tokens: / * Binds to the default frux handler . The default frux handler will handle incoming POST request with : body . action - > the action we want to process . body . payload - > the payload we want to attach to it . If action is not specified we fail .
pl_tokens: function setCors ( req , res , verb ) { let dom = this [ config ] . cors ; if ( dom === true ) { dom = req . headers [ 'origin' ] || '*' ; } else if ( dom instanceof Array ) { if ( ! req . headers [ 'origin' ] ) { dom = false ; } else { let found = false ; for ( let i = 0 , len = dom . length ; i < len ; i ++ ) { if ( dom [ i ] . indexOf ( req . headers [ 'origin' ] ) === - 1 ) continue ; found = true ; dom = dom [ i ] ; break ; } if ( ! found ) return ; } } // CHECK if we have corsIgnore in settings let ignoreHosts ; if ( typeof this [ config ] . corsIgnore === 'string' ) { ignoreHosts = [ this [ config ] . corsIgnore ] ; } else if ( this [ config ] . corsIgnore instanceof Array ) { ignoreHosts = this [ config ] . corsIgnore ; } if ( ignoreHosts instanceof <mask> ) { let origin = getRawOrigin ( dom ) ; for ( let i = 0 ; i < ignoreHosts . length ; i ++ ) { let domain = ignoreHosts [ i ] , isMatch = matchCorsOrigin ( domain , origin , dom ) ; if ( isMatch ) return ; } } if ( ! dom ) return ; res . header ( 'Access-Control-Allow-Origin' , dom ) ; res . header ( 'Access-Control-Allow-Methods' , verb . toUpperCase ( ) + ', OPTIONS' ) ; res . header ( 'Access-Control-Allow-Credentials' , 'true' ) ; res . header ( 'Access-Control-Allow-Headers' , req . headers [ 'access-control-request-headers' ] || '*' ) ; res . header ( 'Access-Control-Max-Age' , '600' ) ; }