sugo-module-noop

4.0.4 • Public • Published

sugo-module-noop

Build Status npm Version JS Standard

NOOP module for SUGOS

This is a stub module for testing purpose. ("noop" stands for "No-Operation")

It has only few basic methods.

Installation

$ npm install sugo-module-noop --save

Usage

Register a module to actor.

#!/usr/bin/env node
 
/**
 * Example usage to register module on actor
 * @see https://github.com/realglobe-Inc/sugo-actor
 */
'use strict'
 
const sugoModuleNoop = require('sugo-moduel-noop')
const sugoActor = require('sugo-actor')
const co = require('co')
 
co(function * () {
  let actor = sugoActor('http://my-sugo-cloud.example.com/actors', {
    key: 'my-actor-01',
    modules: {
      // Register the module
      noop: sugoModuleNoop({})
    }
  })
  yield actor.connect()
}).catch((err) => console.error(err))
 

Then, call the module from a remote caller.

#!/usr/bin/env node
 
/**
 * Example to call from caller
 * @see https://github.com/realglobe-Inc/sugo-caller
 */
'use strict'
 
const co = require('co')
const assert = require('assert')
const sugoCaller = require('sugo-caller')
 
co(function * () {
  let caller = sugoCaller('http://my-sugo-cloud.example.com/callers', {})
  let actor = caller.connect('my-actor-01')
 
  // Access to the interface
  let noop = actor.noop()
 
  // Send ping
  let pong = yield noop.ping()
  assert.ok(pong)
 
// Just ping-pong, nothing more
}).catch((err) => console.error(err))
 

Methods

The following methods are available from remote terminals for the interface.

.ping(pong) -> string

Test the reachability of a module.

Param Type Description
pong string Pong message to return

.assert() -> boolean

Test if the spot fulfills system requirements

License

This software is released under the Apache-2.0 License.

Links

Readme

Keywords

Package Sidebar

Install

npm i sugo-module-noop

Weekly Downloads

2

Version

4.0.4

License

Apache-2.0

Last publish

Collaborators

  • realglobe