1

I'm new to Angular 2, but I understand the concepts when routing subdomains, I have a wildcard DNS record setup and want one angular application to pick up the request when it comes in.

To make things a little more fun the client has an API which will require a unique API key for each subdomain, so I will effectively need to lookup the clients API based on their subdomain and from there include it in every request without making subsequent requests to the initial lookup service to obtain their API key before making subsequent requests to the data i'm really interested in.

A few questions arise on this approach

1) Would you create a service to lookup this information based on the subdomain. If so how would you store it on the initial lookup in order to not having to keep requesting it.

2) Would it be better to keep this sort of information in a json file and if so how would it be kept secure and as more of a config type of resource.

1) How would I persist any data initially looked up based on the subdomain? (I don't want to hit the endpoint every time a request is loaded to get the clients API key in order to then pass onto further API requests).

3) Is there any way to persist the initial client data through services to build up dynamic headers in order to wrap this in every request to the API endpoint?

Z. Bagley
  • 8,942
  • 1
  • 40
  • 52

0 Answers0