屏蔽微信内部浏览器右上方分享按钮

function onBridgeReady() {  
    WeixinJSBridge.call('hideOptionMenu');  
}  
  
if (typeof WeixinJSBridge == "undefined") {  
    if (document.addEventListener) {  
        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);  
    } else if (document.attachEvent) {  
        document.attachEvent('WeixinJSBridgeReady', onBridgeReady);  
        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);  
    }  
} else {  
    onBridgeReady();  
} 

nodejs 常用插件

使用会话:
1.安装express-session中间件

npm install express-session

2.安装cookie-parser中间件

npm install cookie-parser

3.注册后台(app.js)

var session = require('express-session');
var cookieParser = require('cookie-parser');
app.use(cookieParser());
app.use(session({
    secret: 'zhouxiangblog',
    resave: true,
    saveUninitialized: false
}));

4.写入session

req.session.userinfo = userinfo;

5.读取session

req.session.userinfo

GZIP压缩:
1.安装compression

npm install compression

2.在APP.JS里 var app = express(); 该位置下面 添加如下代码即可

var compression = require('compression');
app.use(compression());

这样就完成了nodejs开启GZIP压缩的功能

缓存:
1.安装memory-cache

npm install memory-cache

2.调用方法

var cache = require('memory-cache');// now just use the cachecache.put('foo', 'bar');
console.log(cache.get('foo'))// that wasn't too interesting, here's the good part
cache.put('houdini', 'disappear', 100) // Time in msconsole.log('Houdini will now ' + cache.get('houdini'));
setTimeout(function() {  
    console.log('Houdini is ' + cache.get('houdini'));
}, 200);