Skip to content

Instantly share code, notes, and snippets.

@zubairov
Last active February 7, 2018 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zubairov/727014cd627e1bef23a4d64aaab74d6e to your computer and use it in GitHub Desktop.
Save zubairov/727014cd627e1bef23a4d64aaab74d6e to your computer and use it in GitHub Desktop.
Simples e.io component

HOWTO

mkdir fubar
cd fubar
npm init .
# Don't forget to specify the test command like 'exit 0'
npm install --save elasticio-sailor-nodejs
npm install --save fibonacci-fast
# Copy files above
echo "node_modules" > .gitignore
git init .
git add * .gitignore
git commit -a -m 'Initial commit'
git remote add xpc XXX@XXX.XXX:XXX
git push xpc master
{
"title": "Sample Component",
"description": "Minimal component for demo purposes",
"actions": {
"fibonacci": {
"title": "Fibonacci",
"description": "Compute fibonacci number",
"main": "./index.js"
}
}
}
const fibonacci = require('fibonacci-fast');
module.exports.process = async function process(msg) {
const number = msg.body.number || 10;
return {
body: {
result: fibonacci.get(number)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment