trooba-xhr-transport

2.0.2 • Public • Published

trooba-xhr-transport

codecov Build Status NPM Downloads Known Vulnerabilities

XHR transport for trooba pipeline to make CORS RESTful service calls from the browser.

Get Involved

  • Contributing: Pull requests are welcome!
  • Support: Join our gitter chat to ask questions to get support from the maintainers and other Trooba developers

Install

npm install trooba-xhr-transport --save

Usage

var xhrTransport = require('trooba-xhr-transport');
require('trooba')
    .use(xhrTransport, {
        protocol: 'http:',
        hostname: 'www.google.com'
        socketTimeout: 1000
    })
    .build()
    .create('client:default')
    .get({
        q: 'nike'
    })
    .set('some', 'header')
    .end(function (err, response) {
        console.log(err, response && response.body)
    });

For a real browser example, take a look at unit test. It uses lasso-js and marko-js to bundle resources into browser page including trooba xhr implementation.

Package Sidebar

Install

npm i trooba-xhr-transport

Weekly Downloads

4

Version

2.0.2

License

MIT

Last publish

Collaborators

  • kprakasam
  • dimichgh