2.0.5 • Published 6 years ago

rx-get v2.0.5

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

rx-get

Size CircleCI code style: prettier

⛽️ An observable wrapper for nodes http.get

Install

yarn add rx-get

or

npm install rx-get

Usage

const get = require('rx-get');

const token = 'your_github_token';

// Simple GET request
get('https://api.github.com/emojis', {
  headers: {
    'user-agent': 'rx-get/1.0 (+https://github.com/ericadamski/rx-get)',
  },
}).subscribe({
  next({ status, json, text }) {
    console.log(status);
    console.log(json());
  },
});

// GraphQL POST request
get('https://api.github.com/graphql', {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: `Bearer ${token}`,
  },
  body: JSON.stringify({
    query: /* GraphQL */ `
      {
        user(login: "ericadamski") {
          repositories(last: 5) {
            nodes {
              name
            }
          }
        }
      }
    `,
  }),
}).subscribe({
  next(response) {
    console.log(response.json());
  },
});
2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago