https://github.com/eahefnawy/backend.js
Import your λ functions into the browser.
https://github.com/eahefnawy/backend.js
aws aws-lambda browser javascript lambda serverless
Last synced: about 1 year ago
JSON representation
Import your λ functions into the browser.
- Host: GitHub
- URL: https://github.com/eahefnawy/backend.js
- Owner: eahefnawy
- Created: 2019-01-27T09:06:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T10:58:32.000Z (about 7 years ago)
- Last Synced: 2025-03-11T11:49:30.124Z (about 1 year ago)
- Topics: aws, aws-lambda, browser, javascript, lambda, serverless
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
backend.js is a super light module that lets you imports your λ functions into the browser as a backend library.
### Usage
**Important Note:** To keep your AWS account secure, make sure you pass access keys with limited access to **only** invoke the functions you want to invoke.
#### React
```
npm i --save @eahefnawy/backend.js
```
```js
import { backend } from '@eahefnawy/backend.js'
const config = {
import: ['sendSms', 'sendEmail'], // λ function names that you'd like to import
region: 'us-east-1',
accessKeyId: 'xxx',
secretAccessKey: 'xxx'
}
const { sendSms, sendEmail } = backend(config)
await sendSms({ some: 'inputs' })
await sendEmail({ some: 'inputs' })
```
#### HTML
```html
const config = {
import: ['sendSms', 'sendEmail'], // λ function names that you'd like to import
region: 'us-east-1',
accessKeyId: 'xxx',
secretAccessKey: 'xxx'
}
const { sendSms, sendEmail } = backend(config)
sendSms({ some: 'inputs' })
sendEmail({ some: 'inputs' })
```