Nice Philanthropist Metalhead

    express-cocaine-service

    0.0.7 • Public • Published

    express-cocaine-service

    NPM version Build Status Coverage Status Dependency Status

    Cocaine service middleware wrapper for express

    Cocaine

    This module will work only in cocained express applicaion

    Install

    npm install express-cocaine-service --save

    Example

    var app = express();
     
    // with default client
    // new cocaine.Client(argv.locator)
    app.use(require('express-cocained-service')('geobase', 'uatraits'));
     
    // or with custom client
    var Vow = require("vow");
    var promises = require("cocaine/lib/client/methods/promises_shim").Vow(Vow);
    var methods = require("cocaine/lib/client/methods/promises")(promises);
    var cocaine = require("cocaine");
    var client = new cocaine.Client(['apefront.tst.ape.yandex.net', 10053], methods)
    app.use(require('express-cocained-service')({ client: client }, 'geobase', 'uatraits'));
     
    app.get('/', function (req, res) {
        // Use req.service.geobase and req.service.uatraits
    });

    API

    express-cocaine-service([options,] service, service, ...)

    Request services from cocaine and store put links to them at every request.

    Options

    [options.client] — predefined custom cocaine client

    See connect-once options.

    Install

    npm i express-cocaine-service

    DownloadsWeekly Downloads

    3

    Version

    0.0.7

    License

    MIT

    Last publish

    Collaborators

    • floatdrop