apinf / platform

Apinf - Open source API management platform with multi proxy and protocol support
https://apinf.com/
European Union Public License 1.1
74 stars 33 forks source link

Determine how to handle API Umbrella base URL consistently in project #1535

Closed brylie closed 6 years ago

brylie commented 8 years ago

The Proxies collection schema contains a sub object for apiUmbrella settings. The apiUmbrella object contains a host field that is used in two ways in our code:

  1. when making calls to API Umbrella Admin API
    • e.g. for integration with API Umbrella
  2. when displaying Base URL to end user, where API has a Proxy Backend configured
    • e.g. for users who call the API through the Proxy

In both cases, the URL takes slightly different structure:

  1. http://base.url/api-umbrella/
  2. http://base.url/<proxy_base_path>

Determine what input to take in the Proxy Settings form, and how to construct the URLs in both of the above scenarios.

jykae commented 8 years ago

My opinion is that this would be closely related to api-umbrella wrapper code, related to Umbrella Admin API v1 what path Admin API lives. So I would handle that path inside wrapper so that our code would not need to know what path Admin API lives.

So we would pass only "host" for ApiUmbrellaWeb https://github.com/apinf/meteor-api-umbrella/blob/master/server/apiUmbrellaWeb.js#L22 instead of baseUrl that could be constructed by concatenating /api-umbrella/ after that. If that is v1 related under v1 (self.adminApi.v1.baseUrl) or just as one private member of ApiUmbrellaWeb class (self.baseUrl = self.host + /api-umbrella/

brylie commented 8 years ago

I was thinking of a regex for the url this morning. In effect, we want the URL to

As an aside, I would like to introduce a regex library that would allow us to define our regular expressions in a similar manner to the above list. One option would be the regularity library.