[英]Use pipl with Node.js
I am trying to use pipl with Node.js . 我正在尝试将pipl与Node.js一起使用。 I have written the following code: 我写了以下代码:
router.post('/httpOnly/enrich/pipl', (req, res) => {
var pipl = require('pipl')('BUSINESS-PREMIUM-DEMO-xyozhmgkc57085z7...');
pipl.search.query('json', {"email": "softtimur@gmail.com"}, function(err, data) {
console.log(data);
res.json(data)
});
})
However, it gave an error: 但是,它给出了一个错误:
index.js POST /httpOnly/enrich/pipl
http://api.pipl.com/search/v4/
/.../node_modules/pipl/lib/inherits.js:32
return callback(err, JSON.parse(body) || body);
^
TypeError: callback is not a function
at Request._callback (/.../node_modules/pipl/lib/inherits.js:32:28)
at Request.self.callback (/.../node_modules/request/request.js:123:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/.../node_modules/request/request.js:893:14)
at emitOne (events.js:120:20)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/.../node_modules/request/request.js:844:12)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Does anyone know what's wrong? 有人知道怎么了吗?
From the documentation it looks like the syntax is: 从文档中看,语法如下:
pipl.search.query({"email": "softtimur@gmail.com"}, function(err, data) {
console.log(data);
res.json(data)
});
Without the 'json'
string at the beginning. 开头没有'json'
字符串。 I think the signature was changed without the documentation on npm being updated. 我认为签名已更改,但npm的文档没有更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.