1.1.1 • Published 4 years ago

wj-general-tools v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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
1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago