wj-general-tools

1.1.1 • Public • Published

wj-general-tools

A collection of common tools in a node environment

Install

$ npm install wj-general-tools

Usage

Use of JWT module

const Tools = require('wj-general-tools');
const jwt = new Tools.Jwt(secret);
let token = jwt.createToken({uid: 123}, '10000');
res.send(token);

Use of Logger module

const Tools = require('wj-general-tools');
let config = {
        categories: "log_file",
        appenders: {
            type: "dateFile",
            filename: file,
        },
        level: "debug"
    };
const logger = new Tools.Logger(config);
logger.debug('this is debug info');

Use of Redis module

const Tools = require('wj-general-tools');
const redisClient = new Tools.Redis();
let config = {host: '127.0.0.1', port: '6379'};
redisClient = new Redis(config);
redisClient.set('test', 11111);
redisClient.expire('test');
redisClient.get('test');

Related Modules

  • jsonwebtoken — JSON Web Token sign and verification
  • log4js — Log debugging and output
  • bluebird — Promise using encapsulation
  • redis — Redis module using encapsulation

Readme

Keywords

Package Sidebar

Install

npm i wj-general-tools

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

21.9 kB

Total Files

11

Last publish

Collaborators

  • crazy2019