├── .gitattributes ├── .gitignore ├── .travis.yml ├── .editorconfig ├── lib └── index.js ├── LICENSE ├── test └── index.js ├── package.json ├── gulpfile.js └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - v5 4 | - v4 5 | - '0.12' 6 | - '0.10' 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | auth: require('node-weixin-auth'), 3 | oauth: require('node-weixin-oauth'), 4 | media: require('node-weixin-media'), 5 | pay: require('node-weixin-pay'), 6 | menu: require('node-weixin-menu'), 7 | link: require('node-weixin-link'), 8 | jssdk: require('node-weixin-jssdk'), 9 | user: require('node-weixin-user'), 10 | message: require('node-weixin-message') 11 | }; 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 calidion (calidion.github.io) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | var weixin = require('../'); 2 | var assert = require('assert'); 3 | 4 | /* eslint space-before-function-paren: [2, "never"] */ 5 | /* eslint-env es6 */ 6 | 7 | describe('weixin test', function() { 8 | it('should pass', function() { 9 | var modules = [ 10 | 'user', 11 | 'jssdk', 12 | 'menu', 13 | 'media', 14 | 'pay', 15 | 'link', 16 | 'auth', 17 | 'oauth', 18 | 'message' 19 | ]; 20 | for (var i = 0; i < modules.length; i++) { 21 | var module = modules[i]; 22 | assert.equal(true, typeof weixin[module] === 'object'); 23 | } 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-weixin-api", 3 | "version": "0.5.0", 4 | "description": "Nodejs微信公共平台API", 5 | "homepage": "", 6 | "author": { 7 | "name": "calidion", 8 | "email": "calidion@gmail.com", 9 | "url": "calidion.github.io" 10 | }, 11 | "files": [ 12 | "lib" 13 | ], 14 | "main": "lib/index.js", 15 | "keywords": [ 16 | "" 17 | ], 18 | "dependencies": { 19 | "node-weixin-auth": "^0.6.1", 20 | "node-weixin-jssdk": "^0.5.0", 21 | "node-weixin-link": "^0.5.0", 22 | "node-weixin-media": "^0.5.0", 23 | "node-weixin-menu": "^0.6.0", 24 | "node-weixin-message": "^0.1.1", 25 | "node-weixin-oauth": "^0.3.0", 26 | "node-weixin-pay": "^0.3.1", 27 | "node-weixin-settings": "^0.2.0", 28 | "node-weixin-user": "^0.6.0" 29 | }, 30 | "devDependencies": { 31 | "eslint-config-xo": "^0.13.0", 32 | "eslint-config-xo-space": "^0.12.0", 33 | "gulp": "^3.9.0", 34 | "gulp-coveralls": "^0.1.0", 35 | "gulp-eslint": "^2.0.0", 36 | "gulp-exclude-gitignore": "^1.0.0", 37 | "gulp-istanbul": "^0.10.3", 38 | "gulp-mocha": "^2.0.0", 39 | "gulp-nsp": "^2.1.0", 40 | "gulp-plumber": "^1.0.0" 41 | }, 42 | "eslintConfig": { 43 | "extends": "xo-space", 44 | "env": { 45 | "mocha": true 46 | } 47 | }, 48 | "repository": "node-weixin/node-weixin-api", 49 | "scripts": { 50 | "prepublish": "gulp prepublish", 51 | "test": "gulp" 52 | }, 53 | "license": "Apache-2.0" 54 | } 55 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var gulp = require('gulp'); 4 | var eslint = require('gulp-eslint'); 5 | var excludeGitignore = require('gulp-exclude-gitignore'); 6 | var mocha = require('gulp-mocha'); 7 | var istanbul = require('gulp-istanbul'); 8 | var nsp = require('gulp-nsp'); 9 | var plumber = require('gulp-plumber'); 10 | var coveralls = require('gulp-coveralls'); 11 | 12 | gulp.task('static', function () { 13 | return gulp.src('**/*.js') 14 | .pipe(excludeGitignore()) 15 | .pipe(eslint()) 16 | .pipe(eslint.format()) 17 | .pipe(eslint.failAfterError()); 18 | }); 19 | 20 | gulp.task('nsp', function (cb) { 21 | nsp({package: path.resolve('package.json')}, cb); 22 | }); 23 | 24 | gulp.task('pre-test', function () { 25 | return gulp.src('lib/**/*.js') 26 | .pipe(excludeGitignore()) 27 | .pipe(istanbul({ 28 | includeUntested: true 29 | })) 30 | .pipe(istanbul.hookRequire()); 31 | }); 32 | 33 | gulp.task('test', ['pre-test'], function (cb) { 34 | var mochaErr; 35 | 36 | gulp.src('test/**/*.js') 37 | .pipe(plumber()) 38 | .pipe(mocha({reporter: 'spec'})) 39 | .on('error', function (err) { 40 | mochaErr = err; 41 | throw err; 42 | }) 43 | .pipe(istanbul.writeReports()) 44 | .on('end', function () { 45 | cb(mochaErr); 46 | }); 47 | }); 48 | 49 | gulp.task('watch', function () { 50 | gulp.watch(['lib/**/*.js', 'test/**'], ['test']); 51 | }); 52 | 53 | gulp.task('coveralls', ['test'], function () { 54 | if (!process.env.CI) { 55 | return; 56 | } 57 | 58 | gulp.src(path.join(__dirname, 'coverage/lcov.info')) 59 | .pipe(coveralls()); 60 | }); 61 | 62 | gulp.task('prepublish', ['nsp']); 63 | gulp.task('default', ['static', 'test', 'coveralls']); 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-weixin-api 2 | 3 | [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Beerpay](https://beerpay.io/node-weixin/node-weixin-api/badge.svg?style=flat-square)](https://beerpay.io/node-weixin/node-weixin-api) 4 | 5 | # 基于nodejs的微信公共平台API的SDK 6 | 7 | 目标是实现一个 8 | 9 | 1. 模块化、组件化、代码简洁、低耦合 10 | 2. 可以使用单独的模块 11 | 3. 也可以很方便的组合起来使用 12 | 4. 有清晰的架构组织, 13 | 5. 良好的协作模式 14 | 6. 支持服务器的规模化(Scalable) 15 | 7. 支持全面的API 16 | 17 | 的第三方微信API的node微信实现。方便开发者讯速构建微信服务。 18 | 19 | # 框架无关的API库 20 | 21 | 支持所有的web框架: express, koa, hapi, loopback等 22 | 23 | ## 帮助与交流 24 | 25 | 交流论坛: [http://forum.node-weixin.com/](http://forum.node-weixin.com/) 26 | 27 | > 唯一官方支持平台。 28 | 29 | ## 关注公共账号支持node-weixin的发展 30 | ![](http://res.cloudinary.com/dawjytvkn/image/upload/v1464858605/qrcode_for_gh_6f66da401fef_430_b1rr96.jpg) 31 | 32 | 33 | ## 组成 34 | 35 | [node-weixin-api](https://github.com/node-weixin/node-weixin-api)是基于node-weixin-*的API接口的SDK。 36 | 37 | 它们都是由下列子项目组合而成, node-weixin-api只是将业务接口统一到一个api里方便调用,而不必一个一个重新安装: 38 | 39 | 1. [node-weixin-config](https://github.com/node-weixin/node-weixin-config) 40 | 用于微信配置信息的校验 41 | 42 | 2. [node-weixin-auth](https://github.com/node-weixin/node-weixin-auth) 43 | 用于与微信服务器握手检验 44 | 45 | 3. [node-weixin-util](https://github.com/node-weixin/node-weixin-util) 46 | 一些常用的微信请求,加密,解密,检验的功能与处理 47 | 48 | 4. [node-weixin-request](https://github.com/node-weixin/node-weixin-request) 49 | 微信的各类服务的HTTP请求的抽象集合 50 | 51 | 5. [node-weixin-oauth](https://github.com/node-weixin/node-weixin-oauth) 52 | 微信OAuth相关的操作 53 | 54 | 6. [node-weixin-pay](https://github.com/node-weixin/node-weixin-pay) 55 | 微信支付的服务器接口 56 | 57 | 7. [node-weixin-jssdk](https://github.com/node-weixin/node-weixin-jssdk) 58 | 微信JSSDK相关的服务器接口 59 | 60 | 8. [node-weixin-menu](https://github.com/node-weixin/node-weixin-menu) 61 | 微信菜单相关的操作与命令 62 | 63 | 9. [node-weixin-media](https://github.com/node-weixin/node-weixin-media) 64 | 微信多媒体相关的操作 65 | 66 | 10. [node-weixin-user](https://github.com/node-weixin/node-weixin-user) 67 | 微信用户相关的操作与命令 68 | 69 | 11. [node-weixin-link](https://github.com/node-weixin/node-weixin-link) 70 | 微信推广相关的操作 71 | 72 | 12. [node-weixin-message](https://github.com/node-weixin/node-weixin-message) 73 | 微信消息处理模块 74 | 75 | ## 集成的模块有: 76 | 77 | [weixin.auth](https://github.com/node-weixin/node-weixin-auth) 78 | 79 | [weixin.oauth](https://github.com/node-weixin/node-weixin-oauth) 80 | 81 | [weixin.user](https://github.com/node-weixin/node-weixin-user) 82 | 83 | [weixin.pay](https://github.com/node-weixin/node-weixin-pay) 84 | 85 | [weixin.jssdk](https://github.com/node-weixin/node-weixin-jssdk) 86 | 87 | [weixin.menu](https://github.com/node-weixin/node-weixin-menu) 88 | 89 | [weixin.media](https://github.com/node-weixin/node-weixin-media) 90 | 91 | [weixin.link](https://github.com/node-weixin/node-weixin-link) 92 | 93 | [weixin.message](https://github.com/node-weixin/node-weixin-message) 94 | 95 | ## 安装 96 | 97 | ```sh 98 | $ npm install --save node-weixin-api 99 | ``` 100 | 101 | ## 使用 102 | 103 | 请参考各API的README文件指导与测试用例。 104 | > 所有示例以测试用例代码为准。 105 | 106 | 107 | ## License 108 | 109 | Apache-2.0 © [calidion](calidion.github.io) 110 | 111 | 112 | [npm-image]: https://badge.fury.io/js/node-weixin-api.svg 113 | [npm-url]: https://npmjs.org/package/node-weixin-api 114 | [travis-image]: https://travis-ci.org/node-weixin/node-weixin-api.svg?branch=master 115 | [travis-url]: https://travis-ci.org/node-weixin/node-weixin-api 116 | [daviddm-image]: https://david-dm.org/node-weixin/node-weixin-api.svg?theme=shields.io 117 | [daviddm-url]: https://david-dm.org/node-weixin/node-weixin-api 118 | [coveralls-image]: https://coveralls.io/repos/node-weixin/node-weixin-api/badge.svg 119 | [coveralls-url]: https://coveralls.io/r/node-weixin/node-weixin-api 120 | --------------------------------------------------------------------------------