remi-expose

    1.0.0 • Public • Published

    remi-expose

    A remi extension that adds the expose method to the target

    Dependency Status Build Status npm version Coverage Status

    Installation

    npm i remi-expose
    

    Usage

    Registering the extension

    const remi = require('remi')
    const remiExpose = require('remi-expose')
     
    const app = {}
    const registrator = remi(app)
    registrator.hook(remiExpose())

    Once the remi-expose extension is registered, the remi plugins can expose values.

    app.expose(key, value)

    Used within a plugin to expose a property via app.plugins[name] where:

    • key - the key assigned (server.plugins[name][key]).
    • value - the value assigned.
    exports.register = function(app, opts, next) {
      app.expose('util', () => console.log('something'))
      next()
    }

    server.expose(obj)

    Merges a shallow copy of an object into to the existing content of server.plugins[name] where:

    • obj - the object merged into the exposed properties container.
    exports.register = function(app, opts, next) {
      app.expose({
        util() {
          console.log('something')
        },
      })
      next()
    }

    License

    MIT © Zoltan Kochan

    Install

    npm i remi-expose

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • zkochan