Skip to content

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

@shabeer-ali-m

Description

@shabeer-ali-m

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions