21. プロジェクト作成$ serverless project create
Serverless: Enter a project name: (serverlessN1A2rULrx) akira-test
Serverless: Enter a project domain (used for serverless regional bucket
names): (myapp.com) akira-test.com
Serverless: Enter an email to use for AWS alarms: (me@myapp.com)
Serverless: Select a region for your project:
us-east-1
us-west-2
eu-west-1
> ap-northeast-1
Serverless: Select an AWS profile for your project:
> default
Serverless: Creating a project region bucket on S3:
serverless.apnortheast1.akira-test.com...
Serverless: Creating CloudFormation Stack for your new project (~5 mins)...
Serverless: Successfully created project: akira-test
23. コンポーネント作成
$ sls component create
$ serverless component create
Serverless: Enter a name for your new component: (nodejscomponent)
Serverless: Enter a name for your component's first module: (resource)
Serverless: Enter a name for your module's first function: (show)
Serverless: Successfully created function: "show"
Serverless: Successfully created new serverless module "resource" inside the
component "nodejscomponent"
Serverless: Installing "serverless-helpers" for this component via NPM...
Serverless: Successfully created new serverless component: nodejscomponent
29. テスト
$ sls function run
$ sls function run -n {funcName}
? event.json にリクエストを記述する
? 上記コマンドを実行すると、event.jsonを?
リクエストに見立てて実行することができる。
show
├ handler.js
├ event.json
└ s-function.json
31. $ sls dash deploy
Serverless: Select the functions and endpoints you wish to deploy
location - readlocations
> function - readlocations
endpoint - location - GET
location - deletelocation
function - deletelocation
endpoint - location/{locationId} - DELETE
location - createlocation
function - createlocation
endpoint - location - POST
- - - - -
Deploy
32. いろんなプラグイン
? Serve?
Simulate API Gateway locally
? CORS?
Adds support for CORS
? CloudFormation Validator?
validating CF template
? Optimizer?
Optimizes code for performance in Lambda