Emberjs : Configure router to handle direct 'GET' requests

北慕城南 提交于 2019-12-02 19:27:25

问题


How to configure router to handle xhr and direct requests to api.

Use Case : File Download

I have a RESTAPI from which i am trying to download a file using an <a> action link tag -> clicking on which resolves to a new Tab/Window with absolute url. My webApp is serving at http://localhost:4200 proxying request to http://localhost:44226 When i try to hit the api to download the file using the url http://localhost:4200/api/download/files/1 I Get the error : UnrecognizedURLError: /api/download/files/1

Default Router

const Router = Ember.Router.extend({
  location: config.locationType // auto
});

Router.map(function() {
  this.route('login');
  this.route('logout');
});
export default Router;

Any pointers how to proceed/what to change.

来源:https://stackoverflow.com/questions/39359470/emberjs-configure-router-to-handle-direct-get-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!