【发布时间】:2020-10-25 23:58:03
【问题描述】:
我在 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};
任何安全的解决方案最终都会在公共互联网上让我从任何地方访问我的灯吗?
【问题讨论】:
标签: node.js http fetch philips-hue