How to use external rest api in Sails js (nodejs MVC)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Im using sailsjs as a MVC for node js, i'm still learning it. I managed to get data from my own database and use it. But now i need/want to get data from an external rest api. I used this in my controller: // api/controllers/SomeController.js test : function(res,req){ var j; var https = require('https'); var options = { hostname: 'testing.atlassian.net', port: 443, path: '/rest/api/2/search?jql=project=ABC', method: 'GET', headers: {'Authorization': 'Basic ' + 'SuperSecretLoginAndPassword'} }; var req = https.request(options, function(res) {