Skip to content

Deploying and running ClojureScript code on AWS Lambda NodeJS 14.x runtime using nbb and Serverless Framwork

License

Notifications You must be signed in to change notification settings

vharmain/nbb-serverless-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nbb serverless example

This example demonstrates how to deploy and run CLJS code on AWS Lambda NodeJS 14.x runtime using Serverless Framework.

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 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:

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

 npx sls invoke --function add --data '{"body":"{\"x\":1,\"y\":2}"}'

NOTE: npx sls invoke local does not work due to serverless/serverless#11308

Develop

You can edit the code locally or directly in the Lambda Console.

About

Deploying and running ClojureScript code on AWS Lambda NodeJS 14.x runtime using nbb and Serverless Framwork

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published