This repo is derived from AnomalyInnovations/serverless-nodejs-starter
It provides the set up to create an AWS lambda with serverless using babel 7 that is set up to use layers
- jest, eslint and prettier configured
You can create a layer via https://github.com/robcronin/serverless-layer-template
For an example repo of a lambda with a layer created with these templates see here
sls install --url https://github.com/robcronin/serverless-lambda-with-optional-layer-template --name [NAME_OF_YOUR_LAMBDA]
or
git clone https://github.com/robcronin/serverless-lambda-with-optional-layer-template
cd [NAME_OF_YOUR_LAMBDA]yarn./setUp.sh- answer the prompts
Edit the code in handler.js as required
By default it is a simple hello function
yarn deploy- This will run
sls deployassuming your aws credentials are set up
- This will run
- Running
sls offline startwill allow you to pinglocalhost:3000/hello
yarn test will run:
yarn lintyarn jest
- If you created a layer with https://github.com/robcronin/serverless-layer-template you can use
./addLayer.shto set up your lambda to use it - In your layer repo you can use
./local.shto create a local version of your lambda at/optor useyarn watchto watch any changes and update your local version as you develop your layer