More Related Content
Similar to Serverless - Developers.IO 2019 (20)
More from Shuji Watanabe (20)
Serverless - Developers.IO 2019
- 48. AWS
S3 Bucket / Secret Manager
API Gateway
CodePipeline / CodeBuild
Lambda / StepFunctions
CloudFormation
Route53
- 55. nodejs/node_modules
npm install zip
layers
" shared
# $ nodejs
# " node_modules
# " shared
# # " index.js
# # $ package.json
# $ package.json
$ libs
$ nodejs
" node_modules
$ package.json
{
"name": "shared",
"main": "index.js",
"private": true
}
require('shared');
- 63. cappuccino-api
" project.itg.yaml
" project.stg.yaml
$ functions
" api_mng
$ api
" mo_items
$ mo_order
" index.js
" function.yaml
$ event.test.json
$ cap functions deploy itg mo_order
aws_profile: cap-itg
memory: 512
timeout: 15
role: arn:aws:iam:XXXXXXXX:role/lambda_role
environment:
TZ: Asia/Tokyo
LOG_DEBUG: "true"
layers:
- libs
- shared
- 64. cappuccino-api
" project.itg.yaml
" project.stg.yaml
$ functions
" api_mng
$ api
" mo_items
$ mo_order
" index.js
" function.yaml
$ event.test.json
$ cap functions invoke itg mo_order
{
"store_code": "deviocafe_mo-akb",
"user_id": "user|xxxxxxxx",
"payment_type": "stripe-card",
"items": [
{ "user_id": "item_xx", "qty": 2 }
]
}