UNPKG

2.53 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[![Dependencies][dependencies-image]][dependencies-url]
8[![Downloads][npm-downloads-image]][npm-url]
9[![Install Size][install-size-image]][install-size-url]
10[![Contributors][contributors-image]][contributors-url]
11[![Pull Requests Welcome][pull-requests-image]][pull-requests-url]
12
13A wrapper for XMLHttpRequest to allow for simpler RESTful API transactions.
14
15## Client-Side Usage
16
17```html
18<script src="xhr-envelope.js"></script>
19
20<script type="text/javascript">
21 envelope.setBaseUrl("http://127.0.0.1:3000");
22
23 envelope.get(
24 "status",
25 function(error, result) {
26 if(error) {
27 return console.error(error);
28 }
29
30 return console.log(result);
31 }
32 );
33</script>
34```
35
36## Installation
37
38To install this module:
39```bash
40npm install xhr-envelope
41```
42
43## Building
44
45To build the distribution files for this module:
46```bash
47npm run build
48```
49or
50```bash
51gulp build
52```
53
54[npm-url]: https://www.npmjs.com/package/xhr-envelope
55[npm-version-image]: https://img.shields.io/npm/v/xhr-envelope.svg
56[npm-downloads-image]: http://img.shields.io/npm/dm/xhr-envelope.svg
57
58[build-status-url]: https://travis-ci.org/nitro404/xhr-envelope
59[build-status-image]: https://travis-ci.org/nitro404/xhr-envelope.svg?branch=master
60
61[coverage-url]: https://coveralls.io/github/nitro404/xhr-envelope?branch=master
62[coverage-image]: https://coveralls.io/repos/github/nitro404/xhr-envelope/badge.svg?branch=master
63
64[vulnerabilities-url]: https://snyk.io/test/github/nitro404/xhr-envelope?targetFile=package.json
65[vulnerabilities-image]: https://snyk.io/test/github/nitro404/xhr-envelope/badge.svg?targetFile=package.json
66
67[dependencies-url]: https://david-dm.org/nitro404/xhr-envelope
68[dependencies-image]: https://img.shields.io/david/nitro404/xhr-envelope.svg
69
70[install-size-url]: https://packagephobia.now.sh/result?p=xhr-envelope
71[install-size-image]: https://badgen.net/packagephobia/install/xhr-envelope
72
73[contributors-url]: https://github.com/nitro404/xhr-envelope/graphs/contributors
74[contributors-image]: https://img.shields.io/github/contributors/nitro404/xhr-envelope.svg
75
76[pull-requests-url]: https://github.com/nitro404/xhr-envelope/pulls
77[pull-requests-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg