universal-rxjs-ajax
v3.0.0
Published
Makes rxjs's ajax available in Node.js
Downloads
3,788
Maintainers
Readme
universal-rxjs-ajax
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.
Usage
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))
Try it yourself
https://runkit.com/mcmunder/universal-rxjs-ajax-playground
Copyright and license
Copyright 2018, Matthias Munder.
Licensed under the MIT license.