我在我的Philips Hue项目中使用fetch API模块,当我调用本地IP地址(我的中心)时,它会产生标题中的错误。
const fetch = require('node-fetch');
const gateway = "192.168.0.12";
const username = "username";
let getLights = function(){
fetch(`https://${gateway}/api/${username}/lights`, {
method: 'GET'
}).then((res) => {
return res.json();
}).then((json) => {
console.log(json);
});
}
module.exports = {getLights};
有没有安全的解决方案可以让我从任何地方访问我的灯光,因为这个解决方案最终会放到公共互联网上?