2016-06-20

阅读

无穷集合与 ES6 生成器

Node稳定性的研究心得

聚沙

mongo

1
db.dropDatabase()

koa

开发 JSONP 接口:

引入 koa-safe-jsonp 模块

1
2
3
4
5
6
const jsonp = require('koa-safe-jsonp');

jsonp(app, {
  callback: 'callback', // default is 'callback'
  limit: 64, // max callback name string length, default is 512
});

使用:

1
2
3
4
5
6
7
8
9
10
11
12
13
exports.score = function*(next) {
  let params = this.params
  let groupId = params.id;
  let userId = params.userId;

  let userInfo = this.userInfo;
  let scoreType = this.scoreType;
  let list = yield scoreModel.getScoreListByUserId(groupId, userId);

  // ...

  yield this.jsonp = scoreList;
};

MORE

Comments