Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geovanisouza92/cycle-lambda
AWS Lambda function written using Cycle.js
https://github.com/geovanisouza92/cycle-lambda
cyclejs lambda reactive reactive-programming
Last synced: 15 days ago
JSON representation
AWS Lambda function written using Cycle.js
- Host: GitHub
- URL: https://github.com/geovanisouza92/cycle-lambda
- Owner: geovanisouza92
- Created: 2017-02-07T15:52:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T22:46:09.000Z (almost 8 years ago)
- Last Synced: 2023-03-22T20:53:27.505Z (almost 2 years ago)
- Topics: cyclejs, lambda, reactive, reactive-programming
- Language: JavaScript
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cycle-lambda
A tiny example about how to write a [Cycle.js](https://cycle.js.org/) app that runs inside a AWS Lambda function.
The idea is really simple: Use a driver to input Lambda event and context for the **main** function as a *source*, and use the *sink* to send back the result.
All the logic/behavior (and other side-effects like querying a RDS database or making an HTTP call) is handled inside **main** function with the help of other drivers. Note that the Lambda function must have the correct permissions on its role to execute such tasks.
# NPM Scripts
## npm test
Emulates a Lambda handler invocation.
If you want to provide a sample test event, configure it inside `functions//config.json`.
## npm deploy
Deploys a functions as per `functions//config.json` configurations on the target environment.
You must provide three environment variables (could be in a `.env` file): `REGION`, `AWS_ACCESS_KEY` and `AWS_SECRET_ACCESS_KEY` with permissions to put objects on S3 and update function code on Lambda.
# Helper scripts
## `.scripts/emulate.js`
Emulates a Lambda handler invocation. *It does not provide a context object for now.*
## `.scripts/deploy.js`
Deploys a function to Lambda.
## `.scripts/archive.js`
Used by `.scripts/deploy.js` to create a package with function code and `node_modules` dependencies.
## `.scripts/link-functions.js`
Used to link `lib/` code inside the function's folder, allowing emulation and packaging.