All credit goes to jayphelps. Copied from his suggestion made here.
universal-rxjs-ajax
makes Observable.ajax
available in Node.js
by throwing
in xhr2 when necessary.
const {map} = require('rxjs/operators')
const {request} = require('universal-rxjs-ajax')
interface Repo {
name: string
}
// config as accepted by Observable.ajax()
const config = {
url: 'https://api.github.com/orgs/Reactive-Extensions/repos',
method: 'GET', // and so on...
}
request<Repo[]>(config)
.pipe(map(({response}) => response.map((repo) => repo.name)))
.subscribe((repoNames) => console.log(repoNames))
https://runkit.com/mcmunder/universal-rxjs-ajax-playground
Copyright 2018, Matthias Munder.
Licensed under the MIT license.