wj-general-tools
v1.1.1
Published
A collection of common tools in a node environment
Downloads
8
Readme
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