Prototype / Test / Deploy serverless API using Amazon API Gateway.
- TDD using Jest
- Typescript support (using
serverless-webpack
) - Local testing with
serverless-offline
See http://serverless.com for more details.
In my experience NPM v5 had some issues with missing dependencies (quite common, when using linked packages), hence we're sticking to Yarn for the time being. Downgrading to NPM v4 would result with slowe package install times.
yarn global add serverless
- install serverless CLIyarn
install required dependencies- Update your
serverless.yaml
config file:
service: serverless-bootstrap-typescript # <-- here
provider:
name: aws
runtime: nodejs6.10
profile: lambda # <-- aaand... here
plugins:
- serverless-offline
- serverless-webpack
functions:
hello:
handler: handler.hello
events:
- http:
path: test/hello
method: get
$ yarn tdd
Note that this enviroment uses dev.env.json by default
$ yarn deploy
- Author handler in
handlers/
directory - Add new handlers to
<project root>/handlers.ts