Socket
Socket
Sign inDemoInstall

generator-lambda-boilerplate

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-lambda-boilerplate

A scaffold for a nodejs Serverless service, forked from acloud.guru


Version published
Maintainers
1
Created
Source

lambda-boilerplate

1. Enable Circle CI

Be sure to enable CircleCI for this integration and to request @peterjcaulfield to add his own little @plnt9machine user to your project to allow it to automatically generate tags.

2. Exta

If you want to add a visual build status badge to your repo README you can use the following snippet:

[![Build status](https://circleci.com/gh/Plnt9/sls-name-of-your-lambda/tree/master.svg?style=shield&circle-token=<YOUR CIRCLE CI PROJECT TOKEN HERE>)](https://circleci.com/gh/Plnt9/sls-name-of-your-lambda)

Be sure to change the URLs with the real name of your project and to provide a valid Project Level token.

Also if you want to enable notification on our slack channel from Circle CI builds, go to your project settings and select Notifications > chat notifications. Under slack add the following callback url:

https://hooks.slack.com/services/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

Commands available

This boilerplate is ready to provide you some commands:

  • npm test: run the linting and the unit tests for the current project
  • npm run test:lint: run only the linting
  • npm run test:unit: run only the unit tests
  • npm run build: builds the current project into a self-deployable lambda package

Developing a Lambda

To test your lambda from your local machine you can execute the following from the build folder:

sls invoke local --function $handlerName --stage $stage --path ../event/$event.json

The $event.json file is used to mock the event argument that is passed in to your handler.

What else?

Nothing really. Feel free to bootstrap a new discussion in case you think there's something missing here.

Async Await functions

The boilerplate has async/await javascript functionality so the async code can be simplified More docs on the subject: https://ponyfoo.com/articles/understanding-javascript-async-await https://www.twilio.com/blog/2015/10/asyncawait-the-hero-javascript-deserved.html Example

function getAsyncData(param1, ...){
  //returns a Promise
}

async AsyncAwaitFunction function(param1, ...) {
  const asyncResult = await getAsyncData(param1, ...)

  console.log(asyncResult)
}

Keywords

FAQs

Package last updated on 25 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc