This project is a serverless implementation to provide CAP XML services, through the use of AWS Lambda.
There is a global dependency on serverless which is used for configuration and deployments to AWS
npm i -g serverless
npm install
The project can be debugged locally through visual studio code
npm i serverless
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "run processMessage function",
"program": "${workspaceRoot}/node_modules/.bin/sls",
"args": [
"invoke",
"local",
"-f",
"processMessage",
"--path",
"./config/cap.json"
]
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/handler.js"
}
]
}
eg: { "bodyXml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<alert xmlns=\"urn:oasis:names:tc:emergency:cap:1.2\">\r\n <identifier>4eb3b7350ab7aa443650fc9351f02940E</identifier>\r\n <sender>www.gov.uk/environment-agency</sender>\r\n <sent>2017-05-28T11:00:02-00:00</sent>\r\n <status>Actual</status>\r\n <msgType>Alert</msgType>\r\n <source>Flood warning service</source>\r\n <scope>Public</scope>\r\n <info>\r\n <language>en-GB</language>\r\n <category>Met</category>\r\n <event><![CDATA[064 Issue Flood Alert EA]]></event>\r\n <urgency>Immediate</urgency><expires>2022-09-20T11:00:02-00:00</expires><area><geocode><valueName>TargetAreaCode</valueName><value><![CDATA[TESTAREA1]]></value></geocode></area></info></alert>" }
Then run debug through VSC selecting the above config and it will hit the function with the above arguments
npm run deploy
If you have an idea you'd like to contribute please log an issue.
All contributions should be submitted via a pull request.
Copyright, Environment Agency. Licensed under Creative Commons BY 4.0