Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow for customising rest clients #1780

Merged
merged 4 commits into from
Jan 18, 2020
Merged

Conversation

Mattchewone
Copy link
Contributor

Supercedes #1776

Allows for customising the rest client:

const feathers = require('@feathersjs/feathers');
const rest = require('@feathersjs/rest-client');
const { FetchClientService } =rest;

const app = feathers();class MyFetchClient extends FetchClientService {
  getQuery () {
    return {};
  }
}// Connect to a different URL
const restClient = rest('http://feathers-api.com');// Configure an AJAX library (see below) with that client 
app.configure(restClient.fetch(window.fetch, MyFetchClient));// Connect to the `http://feathers-api.com/messages` service
const messages = app.service('messages');

@DaddyWarbucks
Copy link
Member

DaddyWarbucks commented Jan 14, 2020

I believe this was already completed via #1594

But, this PR does actually have a few extra thins like tests, etc. So perhaps it is better to merge this one as well.

EDIT
Disregard my previous comments. I see this PR actually "finishes" the other PR by making that PR's change more accessible.

@daffl
Copy link
Member

daffl commented Jan 14, 2020

Yup, I think they work together well. I think this also relates to #1102 to make it easier to initialize services from multiple REST endpoints.

@daffl daffl merged commit c5cfec7 into feathersjs:master Jan 18, 2020
@daffl
Copy link
Member

daffl commented Jan 18, 2020

Nevermind, I realized that this has been possible properly for years already 😄 This PR has been released in v4.5.0, thank you again!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants