我按照这个例子在react项目中添加了web.config文件。
https://javascript.works-hub.com/learn/how-to-host-a-react-app-on-azure-10042
我在我的web.config中加入了以下代码。
<appSettings>
<add key="SERVICE_BASE_URL"value="https://localhost:44385/"/>
</appSettings>
我需要从react中读取这个值。有什么方法可以做到这一点吗?请给出建议。我试过这种方式。
import "../web.config";
let SERVICE_BASE_URL = '<%= System.Configuration.ConfigurationManager.AppSettings["SERVICE_BASE_URL"].ToString() %>';