0
大部分时间我的前缀fetch或node-fetch与http://localhost
(使其成为绝对网址)。以绝对网址前缀取回
import fetch from 'node-fetch';
fetch('http://localhost/whatever')
是否有避免localhost
部分的任何方式,不是简单地把localhost
在其他变量?
const baseUrl = 'http://localhost';
fetch(`${baseUrl}/whatever`)
非常相关Superagent with absolute url prefix