Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4561

Angular - service request either to server1 or server2 depending in user which will login

$
0
0

Currently for development I have this environment config:

export const environment = {  production: false,  envName: 'dev',  apiEndpoint: 'https://url.to.server1/api/'};

In the module.service.ts services I use apoEndpoint like this:

myServiceMethod1(param: any): Observable<Array<Response>>  {  return this.httpClient.get(environment.apiEndpoint +'rest/service/url/...');

My problem now I have to solve is, there are two servers (server1 with endpoint https://url.to.server1/api/ and server2 with endpoint https://url.to.server2/api/) - exactly ident application but with different URLs.

If a user will login, first I have to show at server1 if this user exists and if not then I have to look up at server2.And if the user is stored in database of server2 than any further request in sevices should be with https://url.to.server2/api/. If user is stored in database of server1 than any further request should be done with https://url.to.server1/api/.

My question now would be how to do this in the best way?


Viewing all articles
Browse latest Browse all 4561

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>