如何在 claudiajs 中使用节点包。我尝试在其中使用 node-twitter-api 和 node-twitter 但得到空白响应。承诺是否需要我在 lambda 中对此一无所知。如果有人有任何示例或文档,这些示例或文档可能具有与 claaudiajs 一起用于 lambda 的多个节点包。参考:http://claudia.js,https : //vimeo.com/156232471
var ApiBuilder = require('claudia-api-builder'),
api = new ApiBuilder();
var twitterAPI = require('node-twitter-api');
var Promise = require("bluebird");
api.get("/request-token", function(request) {
'use strict';
new Promise(function(resolve) {
var twitter = new twitterAPI({
consumerKey: "ckey",
consumerSecret: "cskey",
callback: 'http://localhost:3000/access-token'
});
var res;
twitter.getRequestToken(function(err, requestToken, requestSecret) {
if (err)
res = err;
else {
var _requestSecret = requestSecret;
var url = "https://twitter.com/oauth/authenticate?oauth_token" + requestToken;
res = url;
//res.redirect(url);
}
});
return res;
});
});