js config http endpoint - Hippoom/wechat-mp-starter GitHub Wiki
The starter provides a built-in HTTP endpoint to fetch config for JS SDK. See Inject Correct Authentication Configuration via the config API.
fetch('/wechat/mp/js/config', {
method: 'get'
}).then((response) => {
return response.json()
}).then((config)=> {
wx.config({
appId: config.appId,
timestamp: config.timestamp,
nonceStr: config.nonceStr,
signature: config.signature,
jsApiList: [] // Required, list of JS APIs to be used. See Appendix 2 for the list of all JS APIs
});
});