examples icon indicating copy to clipboard operation
examples copied to clipboard

Is it possible to share variable between functions? (nodejs)

Open shabeer-ali-m opened this issue 3 years ago • 0 comments

Hello,

My serverless.yml

  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
          authorizer: authorizerFunc
  authorizerFunc:
    handler: handler.authorizerFunc

What I want is to set some value in auth.js and get the value in handler.js

auth.js

module.exports.authorizerFunc = (event, context, callback) => {
   //set some value
});

handler.js

module.exports.hello =  (event, context, callback) => {
 //get that value
});

Is it possible ?

shabeer-ali-m avatar Nov 03 '20 06:11 shabeer-ali-m