Automating Lambda across multiple environments
1 min readMay 13, 2017
--
Let’s start with the structure of the “micro.analyze” module. It’s a module that does a whole bunch of text analysis and returns json. Pretty simple.
micro.analyze/
dist/ - where the build stores after babelizing
src/
api.js - the standard layer on top of index.js
index.js - where the real code lives
node_modules/ - duh
.env - credentials
claudia.json - generated, don't worry about it
Dockerfile - the heart of the matter
dockerize.sh - because I hate repeating cmd's
package.json - duh
Let’s take a quick look at the api.js file
We’ve essentially build an api object, assign the default POST path, parse the data from the body, and pass it to the service function (in index.js). You can use the same structure for every app.
And now let’s look at the index.js file: