Sunday, 28 May 2017

RxJS forkjoin isn't running

I am attempting to use RxJS via rx-http-request to query third party APIs from a NodeJS server. In the long run, I want to use RxJS to handle some of the more interesting error cases. But for the time being I am having issues getting a fairly trivial case to run.

Case 1 (this works):

third_party.js
import {RxHttpRequest} from 'rx-http-request'
export default ((name) => RxHttpRequest.get(`www.third.party.com/${name}`)

And then,

   import third from './third_party'
   third('bob').subscribe(console.log)

Case 2(this does not)

   import third from './third_party'
   import Rx from 'rx'
   Rx.Observable.forkJoin(third('bob')).subscribe(console.log)

Case 1 prints the (correct) third party response. Case 2 doesn't appear to ever run at all. When I print out console.log(Rx.Observable.forkJoin) it prints Function, e.g. I have in fact included the right part of Rx.

What is going on here? And how can I fix it?



via Abraham P

No comments:

Post a Comment