Meteor angular2 proxy http/websocket call


#1

Hi,
I would like to proxy my http calls from my angular2 client, is there a way to configure proxy setup for client in DEV & PROD mode, also for WebSockets?

    var httpCall = this.http
                    .post('/blabla/blabla', JSON.stringify(body), {headers: headers})
                    .map(res => res.json());

thx


#2

Have there someone ideas?


#3

there shouldn’t be any difference between Meteor and any other framework.

Can you please add details about your requirements?


#4

hey @Urigo

We have to call external HTTP calls and we do that using @angular/http, we have different environments with different server and endpoints, so we to a call as for example .get(’/api/v1/users/curent’)

In angular-webpack-starter which is using node proxy we have to configure the webpack configuration file for dev/test or production to proxy the request to ‘192.168.1.x/api/v1/users/current’. The same thing we can do on IONIC and other frameworks.
Sorry but I do not understand how and where I can do that in meteor.

can you help me?


#5

@Urigo

as you can see in ionic there are a file named ionic.project there you can configure proxy mapping for some resources
"proxies": [
{
“path”: “/v1”,
“proxyUrl”: “https://api.instagram.com/v1
}
]

I need something like that and I don’t know how to do that in meteor. On other frameworks or packaging tools there are always a configuration file to do that.


#6

Is there really no one who can help me?


#7

If I understand you correctly, you want to create a settings file that will be different for each environment right?

I believe those resources can help you:
https://themeteorchef.com/snippets/making-use-of-settings-json/#tmc-settingsjson-in-development-vs-production

Le me know if that helps