smartcloud

0.3.109 • Public • Published

smartcloud (Alpha)

SmartCloud Utility Library for Node.js

$ npm install --save smartcloud

Create base cloud function

index.js

const SmartCloud = require('smartcloud')();

const myFunction = SmartCloud.SmartFunction(
  {
    functionName: 'test-function',
    trigger: 'user-commands',
    triggerType: 'pubsub',
    targets: [
      { type: 'pubsub', name: 'user-events' },
      { type: 'datastore', name: 'Users'}
    ],
    filter: ['CreateUser']
  }
);

exports.testFunction = function testFunction( event, callback ) {
  return myFunction.run(event, callback, ( newUser ) => {
    newUser.id = Smartcloud.getUUID();
    newUser.timestamp = Date.now();
    myFunction.sendOutput(newUser);
  })
};

exports.getFunctionDetails = function getFunctionDetails( ) {
  return myFunction.options;
}

deploy.js

'use strict';

const app = require('./');
const SC = require('smartcloud')();
const DeployService = SC.Deploy(app);

return DeployService.deploy()
.catch(( error ) => { process.exit(1) });

setup.js

'use strict';

const app = require('./');
const SC = require('smartcloud')();
const SetupService = SC.Setup(app);

return SetupService.runSetup()
.catch(( error ) => { process.exit(1) });

Readme

Keywords

none

Package Sidebar

Install

npm i smartcloud

Weekly Downloads

0

Version

0.3.109

License

Apache-2.0

Unpacked Size

144 kB

Total Files

20

Last publish

Collaborators

  • spt-arif
  • jacrowland1
  • spt-edison
  • alexkozlov
  • deanscratcherd
  • kin.chan
  • mib1085
  • connorsage