UNPKG

1.67 kBMarkdownView Raw
1# XMLHttpRequest Envelope
2
3[![NPM version][npm-version-image]][npm-url]
4[![Build Status][build-status-image]][build-status-url]
5[![Coverage Status][coverage-image]][coverage-url]
6[![Known Vulnerabilities][vulnerabilities-image]][vulnerabilities-url]
7[![Downloads][npm-downloads-image]][npm-url]
8
9A wrapper for XMLHttpRequest to allow for simpler RESTful API transactions.
10
11## Client-Side Usage
12
13```html
14<script src="xhr-envelope.js"></script>
15
16<script type="text/javascript">
17 envelope.setBaseUrl("http://127.0.0.1:3000");
18
19 envelope.get(
20 "status",
21 function(error, result) {
22 if(error) {
23 return console.error(error);
24 }
25
26 return console.log(result);
27 }
28 );
29</script>
30```
31
32## Installation
33
34To install this module:
35```bash
36npm install xhr-envelope
37```
38
39## Building
40
41To build the distribution files for this module:
42```bash
43npm run build
44```
45or
46```bash
47gulp build
48```
49
50[npm-url]: https://www.npmjs.com/package/xhr-envelope
51[npm-version-image]: https://img.shields.io/npm/v/xhr-envelope.svg
52[npm-downloads-image]: http://img.shields.io/npm/dm/xhr-envelope.svg
53
54[build-status-url]: https://travis-ci.org/nitro404/xhr-envelope
55[build-status-image]: https://travis-ci.org/nitro404/xhr-envelope.svg?branch=master
56
57[coverage-url]: https://coveralls.io/github/nitro404/xhr-envelope?branch=master
58[coverage-image]: https://coveralls.io/repos/github/nitro404/xhr-envelope/badge.svg?branch=master
59
60[vulnerabilities-url]: https://snyk.io/test/github/nitro404/xhr-envelope?targetFile=package.json
61[vulnerabilities-image]: https://snyk.io/test/github/nitro404/xhr-envelope/badge.svg?targetFile=package.json