构建Web的API访问路径URL+Port
const origin = window.location.origin;
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = 80;
const API_ROOT = protocol + "//" + hostname + ":" + port;
API_ROOT即为API的访问路径
构建Web的API访问路径URL+Port
const origin = window.location.origin;
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = 80;
const API_ROOT = protocol + "//" + hostname + ":" + port;
API_ROOT即为API的访问路径
本文标题:WebApp 根据访问源获取访问API地址
本文链接:https://www.haomeiwen.com/subject/clhmuttx.html
网友评论