npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

miko-tvc

v0.3.4

Published

NodeJS client for Nameko services

Downloads

6

Readme

Miko (巫女)

JavaScript client to make RPC calls to Nameko services.

Inspired by node-nameko-client by @and3rson 🙏

Installation

npm install miko

Usage

Make sure you have a Nameko service up and running.

You can use the test service:

cd nameko-test-service
docker-compose up --build

Example usage:

const { connect } = require('./src/miko');

// First, connect to the queue
// connect returns a promise which will be resolved when everything goes ok
//
//
//  Default options:
//
// host: '127.0.0.1',
// port: 5672,
// login: 'guest',
// password: 'guest',
// exchange: 'nameko-rpc',
// timeout: 5000,
//

connect()
  .then((rpc) => {
    // Use rpc to make calls to nameko services

    rpc
      .fetch('demo_svc', 'noargs')
      // .fetch('demo_svc', 'get_data')
      // .fetch('demo_svc', 'get_data', [2])
      // .fetch('demo_svc', 'get_data', [], { copies: 10})
      // .fetch('demo_svc', 'required_and_optional', ['test'])
      // .fetch('demo_svc', 'variable', ['test', 'another'], { o: 1 })
      // .fetch('demo_svc', 'return_none')
      // .fetch('demo_svc', 'return_auth_token')
      // .fetch('demo_svc', 'raise_value_error')
      // .fetch('demo_svc', 'raise_exception')
      // .fetch('demo_svc', 'raise_index_error')
        .then((response) => {
          console.log('Response', response);
          rpc.close();
        })
        .catch((err) => {
          console.log('Response error', err);
          rpc.close();
        });
  })
  .catch((err) => {
    console.log('Connection error', err);
  });

Custom loggers

By default, Miko logs what is going on with the connection to Nameko to the console. If you need to use a custom logger (for example, to log events to file or to an external server), you can add your own loggers to Miko.

connect(options, loggers).then(...)

Loggers is an array of Winston loggers.

You can find an example of file logger in test/endpoint.test.js.

Testing

Make sure you have the Nameko test service up and running:

cd nameko-test-service
docker-compose up --build

Then, after the docker containers are set up and running, you can run Miko tests:

npm test

The command above runs all tests. You can also run only unit tests (which don't require Nameko service up and running):

npm run test:unit

License

MIT