scorelab / Bassa

Automated Download Queue for Communities to take the best use of Internet bandwidth
GNU General Public License v3.0
168 stars 494 forks source link

Use Gulp Webserver Proxies to map the API to `/api` #313

Open agentmilindu opened 6 years ago

agentmilindu commented 6 years ago

https://github.com/scorelab/Bassa/blob/b74c25d6012c525cc41fc5ed9d4a0dcca184c6b8/ui/src/app/index.js#L6

Instead localhost:5000, we need to have this value as http://localhost/api, but for this, we have to proxy the Flash API running on port 5000 to /api

See:

  1. https://www.npmjs.com/package/gulp-webserver#options
  2. https://github.com/scorelab/Bassa/blob/master/ui/gulp/proxy.js
iammosespaulr commented 6 years ago

I can do that.

iammosespaulr commented 6 years ago

a small problem though ... if you change BassaUrl to localhost/api then what about the POST requests from DashBoardService.js

          method: 'POST',
          url: BassaUrl + '/api/download',
          data: JSON.stringify(link),
          headers: {'Content-Type': 'application/x-www-form-urlencoded'}

where there is an extra /api so wouldn't the url become localhost/api/api/download and wouldn't the likewise happen for all others ?