【发布时间】:2021-04-22 09:03:48
【问题描述】:
这可能是一个非常愚蠢的问题,但有没有办法在不输入服务器地址的情况下获取?我想知道我是否可以只使用“/init”而不是“http://localhost:3000/init”
try{
const result = await fetch("http://localhost:3001/init",
{
method:"GET",
headers:{
"content-type":"application/json"
}
});
response = await result.json();
}
catch(e){
console.log(e);
}
【问题讨论】: