-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
executable file
·35 lines (29 loc) · 967 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 第三方回调服务器
const config = require('./config');
const app = require('express')();
const bodyParser = require('body-parser');
// 使用bodyParse中间件接收post参数
app.use(bodyParser.json({limit: '1mb'}));
app.use(bodyParser.urlencoded({extended: true, limit: '1mb'}));
// 路由模块
app.use('/message', require('./message'));
// 启动http服务
app.listen(config.http_port, function () {
console.log('wechat reply server listening at', config.http_port);
});
/*
// 创建菜单
// https://github.com/node-webot/wechat-api
// http://blog.csdn.net/sinat_29843547/article/details/49253827
var API = require('wechat-api');
var api = new API(config.api.AppId, config.api.AppSecret);
api.getAccessToken(function (err, token) {
console.log(err);
console.log(token);
});
var menu = JSON.stringify(require('./menu.json'));
api.createMenu(menu, function (err, result) {
console.log(result);
});
*/
// FILE EOF