Reputation: 728
I have a PHP backend at port 7000. I use the webpack skeleton. How can I configure my fetch client to send requests to a different port number.
Upvotes: 0
Views: 2108
Reputation: 161
When setting .withBaseUrl('api/')
you can just specify a port like url:8000/api
and that should work from my experience, there may be a better way but that has worked for me in the past.
Or if you aren't specifying a base url the following should also work:
httpClient.fetch('http://localhost:7000/api/getsomedata')
.then(response => return response.json())
.then(data => {
console.log(data);
});
Upvotes: 3