0.0.2-alpha.0 • Published 4 years ago
ft-parser v0.0.2-alpha.0
ft-parser
Tech
Functions
HTTP Trigger Function (API Gateway)
functions:
# API Endpoints
http:
handler: handler.http #Path to function
memorySize: 128 # Lambda Memory Limit
timeout: 60 # Lambda Timeout
events:
- http: # HTTP Trigger
cors: true
path: '/message' # API Endpoint
method: post # HTTP Method
MQTT Trigger Function (IOT Events)
functions:
# Mqtt Trigger
mqtt:
handler: handler.mqtt #Path to function
events:
- iot: # IOT Trigger
sql: "SELECT * FROM 'mybutton'" #Topic
Development environment
FT-Parser uses serverless-local
plugin and some containers and plugins to emulate the AWS Resources
docker-compose up
The applications will start on http://localhost:3000
Dev Plugins
FT-Parser contains following plugins for local development:
- serverless-offline - For run API Gateway local and manage plugins
- serverless-pseudo-parameters - Currently, it's impossible (or at least, very hard) to use the CloudFormation Pseudo Parameters in your serverless.yml.
- serverless-offline-sqs - This Serverless-offline plugin emulates AWS λ and SQS queue on your local machine. To do so, it listens SQS queue and invokes your handlers.
- serverless-typescrtipt-plugin
Deploy a function
serverless deploy function -f ft-parser
Get function logs
serverless ft-parser
Testing
Parse Message
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"deviceName": "61bef2dd-58bf-479d-a58a-00ef87b1cc90",
"data": "AP6lAWcAUQJoNQP\/AMM=",
"timestamp": 1548404613
}' \
http://localhost:3000/message -i
0.0.2-alpha.0
4 years ago