Nat*_*han 4 http fetch node.js philips-hue
我在我的 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};
Run Code Online (Sandbox Code Playgroud)
任何安全的解决方案最终都会进入公共互联网,让我可以从任何地方访问我的灯吗?
| 归档时间: |
|
| 查看次数: |
14031 次 |
| 最近记录: |