npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-weixin-express-config

v0.1.1

Published

weixin config for expressjs

Readme

node-weixin-express-config NPM version Build Status Dependency Status Coverage percentage

weixin config for expressjs

Installation

$ npm install --save node-weixin-express-config

Usage

初始化

var nodeWeixinExpressConfig = require('node-weixin-express-config');
var settings = require('node-weixin-settings');
var express = require('express')();

express.use(require('skipper')());    //必须有,用于上传p12文件

express.use(bodyParser.urlencoded({
  extended: false
}));
express.use(bodyParser.json());
express.use(bodyParser.raw({
  type: 'text/xml'
}));

直接使用set的方法

nodeWeixinExpressConfig.set(
  settings,
  express,
  // 数据处理完成后的回调函数
  // ID是保存数据唯一识别号,可以自己定义
  // value是所获取或者保存的数据
  function callback(req, res, id, value) {
    res.json({
      id: String(id),
      data: value
    });
  },
  function (req, name) {
    // return req.session[name]
    // return req.session.user.id
    return 1;
  },
  // 获取数据识别ID的参数名
  'appId',
  '/weixin/config/:type'
);

路由部分使用方法

var weixinConfigRouter = nodeWeixinExpressConfig.router;
var handler = weixinConfigRouter(
  //获取数据识别ID的参数名
  'id',
  //node-weixin-settings对象
  settings,
  //数据处理完成后的回调函数
  //ID是保存数据唯一识别号,可以自己定义
  //value是所获取或者保存的数据
  function callback(req, res, id, value) {
  res.json({
    id: id,
    data: value
  });
});

express.use('/weixin/:id', handler);
express.get('/weixin/:id/:type', handler.__handlers.get);
express.post('/weixin/:id/:type', handler.__handlers.post);

配置导入的使用方法

var parser = nodeWeixinExpressConfig.parser;
var file = path.resolve(__dirname, './fixtures/config.json');
var cb = function (json) {
  //json是文件里的JSON配置信息
}
//
//id  用于识别存储的数据
//settings 是node-weixin-settings
//file json文件
//cb 回调函数
parser(id, settings, file, cb);

License

Apache-2.0 © node-weixin