我想为我的应用程序设置基本路径。我用
更新await app.restServer.basePath('/api/v1');
位于我的项目根文件夹中的"index.js"
中。但是,当我尝试访问资源管理器时,会以“无法获取资源管理器” 的方式抛出错误。
await app.basePath('/api/v1');
await app.restServer.basePath('/api/v1');
this.static('/', path.join(__dirname, '../public'));
this.bind(RestBindings.SequenceActions.SEND).toProvider(Validateprovider);
this.bind(RestExplorerBindings.CONFIG).to({
path: path.resolve('/explorer'),
});
一旦加载了应用程序,便可以访问以下URL:http://127.0.0.1:8020/api/v1 但是当我在同一页面上单击资源管理器时。它不会重定向到资源管理器,而是显示错误
“无法获取/ explorer /”
请让我知道如何使用我提到的前缀访问资源管理器。
答案 0 :(得分:0)
答案 1 :(得分:0)
问题可能是,在/publix/index.html
中到资源管理器的链接没有更改,它指向/explorer
。更改基本路径后,应将此链接更改为{your new base path}/explorer
。在应用程序中更改基本路径不会更新静态资源。基本上,在index.html
中,您应该具有:
<h3>API Explorer: <a href="/api/v1/explorer">/explorer</a></h3>
然后它将起作用