slsTestApp is a sample serverless application. slsTestApp has no GUI. This application is supposed to be deployed to AWS by serverless framework.
slslTestApp can CREATE/GET/UPDATE/DELETE Person model data.
-
GET dev/slsTestApp/v1/api/person/{personId}
- Get single Person model match with personId
-
POST dev/slsTestApp/v1/api/person
- Create new single Person model
-
PUT dev/slsTestApp/v1/api/person/{personId}
- Uodate single Person model match with personId
-
DELETE dev/slsTestApp/v1/api/person/{personId}
- Delete single Person model match with personId
Person Model which slsTestApp can accept is below.
{ "age": "28", "height": "178", "name": "tarou", "weight": "70" }
Person Model which generated by slsTestApp is below.
{ "personId": "uuid" "age": "28", "height": "178", "name": "tarou", "weight": "70" }
- Please clone this repository
- Install Nodejs
- Please create AWS Account and IAM user.
- Install AWS CLIv2
- Execute npm command below at root directory.
npm install
- To install serverless framework, execute
npm install -g serverless
-
Replace
{Please replace with your IAM Account ID here.}
to your IAM account id -
Replace
{Please replace with your IP here.}
to your IP address which is allowed to access. -
Add line comment to below at root
serverlss.yml
- \${file(./service/templates/api-gateway.yml)}
-
Deploy Lambda Functions and IAM Role. Execute command below at root directory
sls deploy -v
-
Remove line comment to below at root
serverlss.yml
- \${file(./service/templates/api-gateway.yml)}
-
Deploy API Gateway. Execute command below at root directory
sls deploy -v
-
Deploy WAF IPset. Execute command below at
/waf/ipset
sls deploy -v
-
Deploy WAF WebACL. Execute command below at
/waf/webACL
sls deploy -v
-
Deploy WAF association. Execute command below at
/waf/association
sls deploy -v
- Use HTTPS client tool(ex. curl) and execute slsTestApp APIs.
- Undeploy WAF association. Execute command below at
/waf/association
sls remove
- Undeploy WAF WebACL. Execute command below at
/waf/webACL
sls remove
- Undeploy WAF IPset. Execute command below at
/waf/ipset
sls remove
- Undeploy Lambda Functions, IAM Role and API Gateway. Execute command below at root
sls remove
- Execute jest at root
npm test
- If you want update unit test, show
___test___
directory