【问题标题】:Deployd - separate servers. Different ports已部署 - 单独的服务器。不同的端口
【发布时间】:2017-04-06 14:11:09
【问题描述】:

我的情况如下: 我的服务器在一个端口上运行,可以说 58920 - 这是我的前端服务器 然后我已经部署在其他端口 2403 上运行。

然后我将 dpd.js 文件 (localhost:2403/dpd.js) 复制到我的 frontEndServer 文件系统,以便我可以使用它。

http://docs.deployd.com/docs/collections/reference/dpd-js.html

问题是当我在我的前端服务器上调用一些例如登录时: 发布http://localhost:58920/FirstApp/api/users/login 404(未找到)

因为服务器托管在 :2403 上。

我的问题是:如何更改生成的 dpd.js 文件中的端口?

【问题讨论】:

    标签: javascript deployd


    【解决方案1】:

    Nvm 我找到了:

    dpd.setBaseUrl({protocol : 'http:', hostname : 'localhost', port : '2403'});
    

    https://www.bountysource.com/issues/6881984-feature-dpd-script-can-change-its-url-base

     function setupBaseUrl(options) {
        options = options || {};
        if (typeof options === "string") {
          root = options;
          return;
        }
    
        var protocol = options.protocol || window.location.protocol;
        var hostname = options.hostname || window.location.hostname;
        var port = options.port || window.location.port;
    
        root = protocol + '//' + hostname;
        if (port !== '') {
          root += ':' + port;
        }
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多