跳到主要内容

Web 网页

假设你的公网访问域名是:https://demo.ap-shanghai.run.tcloudbase.com

服务项目中有业务路径如下:

  • /:GET 形式
  • /do:POST 形式
  • /upload:PUT 形式

浏览器中对应的访问如下:

// 【/】GET形式
fetch("https://demo.ap-shanghai.run.tcloudbase.com")
.then((r) => r.json())
.then(console.log);

// 【/do】POST形式
fetch("https://demo.ap-shanghai.run.tcloudbase.com/post", {
method: "POST",
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

// 【/upload】PUT形式
fetch("https://demo.ap-shanghai.run.tcloudbase.com/upload", {
method: "PUT",
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));