GET 取得当前运行 Eagle App 的详细信息,通常我们可以透过这个方式判断用户设备是否能够运行某些功能。

范例代码:

  1. var requestOptions = {
  2. method: 'GET',
  3. redirect: 'follow'
  4. };
  5. fetch("http://localhost:41595/api/application/info", requestOptions)
  6. .then(response => response.json())
  7. .then(result => console.log(result))
  8. .catch(error => console.log('error', error));

返回结果:

  1. {
  2. "status": "success",
  3. "data": {
  4. "version": "1.11.0",
  5. "prereleaseVersion": null,
  6. "buildVersion": "20200612",
  7. "execPath": "/Users/augus/Projects/Eagle App/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper (Renderer).app/Contents/MacOS/Electron Helper (Renderer)",
  8. "platform": "darwin"
  9. }
  10. }