- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/xialeistudio/wechat-nodejs
- 软件文档: https://github.com/xialeistudio/wechat-nodejs/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
软件介绍
Wechat-NodeJS微信公众平台开发NodeJs SDK,本SDK要求NodeJs >= 4.x,欢迎大家在issues提问。
安装
npm install wechat-nodejs
说明
使用所有sdk功能前需要初始化wechat句柄,初始化代码如下:
const Wechat = require('wechat-nodejs').Wechat;
const wechat = new Wechat(appId,appSecret);SDK扩展了JS原始错误类,包含message,code属性,SDK中Promise抛出的错误code为微信返回的errcode,抛出一个自定义错误代码如下:
const AppError = require('wechat-nodejs').AppError;
throw new AppError('参数错误',1);
