Nine Putrid Mangos

    node-service-tools

    0.2.21 • Public • Published

    This is package provides utilities for node services as follows :

    SQL Client

    Example usage:

    const {mysqlClient} = require('node-service-tools');
    
    const dbClient = new mysqlClient(sqldbServer, sqldbPort, sqldbUser, sqldbPass);
    
    dbClient.queryDB2('INSERT INTO table SET ?', new_entry)
        .then(() => {
        	// Success 
        })
        .catch(()=>{
            // Error handling
        })
    

    Redis Client (mostly pub/sub API)

    Example usage:

    const {redisCache} = require('node-service-tools');
    
    const redisClient = new redisCache({
      port: process.env.CACHE_PORT,
      host: process.env.CACHE_HOST
    });
    
    redisClient.publishToChannel(channel, eventSpec); => Publish to channel
    redisClient.subscribeToChannel(channel, callBack); => As name implies
    redisClient.unSubscribe(channel); => as name implies
    redisClient.channelNumSub(channel); => Get number of subscribers in a channel
    

    Websocket client

    Example usage:

    const {wsClient} = require('node-service-tools');
    
    const eventClient = new wsClient({eventServer, eventPort, protocol, source: apiRoot, eventApiKey});
    eventClient.send(eventSpec);
    
    

    Keywords

    none

    Install

    npm i node-service-tools

    DownloadsWeekly Downloads

    11

    Version

    0.2.21

    License

    ISC

    Unpacked Size

    84.3 kB

    Total Files

    29

    Last publish

    Collaborators

    • sabzee