Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

xeta

nivrith22MIT1.0.0TypeScript support: included

lightweight http client for web and node

xeta, xhr, http, node, promise

readme

xeta

CircleCI NPM Downloads node License MIT

Observable based http client for web and node

Highlights

  • Written in Typescript
  • Works in Browser and Node
  • Easy Observable based API

Installation

npm:

$ npm install xeta

yarn:

$ yarn add xeta

Usage

lightweight http client for web and node


  const { xeta } = require('xeta');

  xeta.get('https://jsonplaceholder.typicode.com/todos/1')
  .subscribe((response) => {
    // handle success
    console.log(response);
  },
  (error) => {
    // handle error
    console.error(error)
  },
  ()=>{
    // handle completion
    console.log('complete');
  }
  );

  // Promise

  xeta.get('https://jsonplaceholder.typicode.com/todos/1')
  .toPromise()
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .finally(function () {
    // always executed
  });


  // async/await
  async function getTodo() {
    try {
      const response = await xeta.get('https://jsonplaceholder.typicode.com/todos/1').toPromise();
      console.log(response);
    } catch (error) {
      console.error(error);
    }
  }

License

MIT © Nivrith

changelog

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

v1.0.0

8 September 2019

v0.3.0

8 September 2019

v0.2.4

8 September 2019

v0.2.3

8 September 2019

v0.2.2

8 September 2019

v0.2.1

8 September 2019

v0.2.0

8 September 2019

v0.1.0

8 September 2019