serverless / serverless/examples
Is it possible to share variable between functions? (nodejs)
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 4.4k
- Avg merge
- 2h 55m
- Merged PRs (30d)
- 3
Description
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 ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading serverless.yml and the example snippets in auth.js and handler.js to understand how authorizerFunc and hello are invoked. This issue is an unanswered question rather than a defined change, so the desired behavior and a verifiable definition of done are not specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100