https://github.com/vharmain/nbb-serverless-example
Deploying and running ClojureScript code on AWS Lambda NodeJS 14.x runtime using nbb and Serverless Framwork
https://github.com/vharmain/nbb-serverless-example
Last synced: 11 months ago
JSON representation
Deploying and running ClojureScript code on AWS Lambda NodeJS 14.x runtime using nbb and Serverless Framwork
- Host: GitHub
- URL: https://github.com/vharmain/nbb-serverless-example
- Owner: vharmain
- License: mit
- Created: 2022-01-08T17:34:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T16:59:31.000Z (over 3 years ago)
- Last Synced: 2025-03-30T11:21:55.859Z (about 1 year ago)
- Language: Clojure
- Size: 4.88 KB
- Stars: 23
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nbb serverless example
This example demonstrates how to deploy and run CLJS code on AWS Lambda NodeJS 14.x runtime using [Serverless Framework](https://www.serverless.com/).
We setup a simple HTTP POST endpoint on API Gateway that proxies requests to a lambda function. `index.mjs` file works as a bootstrap that uses [nbb](https://github.com/babashka/nbb/) to load CLJS code when the lambda (cold)starts.
## Prerequisities
* AWS Account and API credentials configured on your system
* Node
## Setup, deployment and testing
* `npm install`
* `npx sls deploy`
Grab the endpoint URL from the output and call it like this:
```shell
curl -X POST -H "Content-Type: application/json" -d '{"x":1,"y":2}' https://1xz3t07x70.execute-api.us-east-1.amazonaws.com/dev/add
```
...or
```shell
npx sls invoke --function add --data '{"body":"{\"x\":1,\"y\":2}"}'
```
NOTE: `npx sls invoke local` does not work due to https://github.com/serverless/serverless/issues/11308
## Develop
You can edit the code locally or directly in the Lambda Console.