Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit 22fca46

Browse files
committed
updating dist
1 parent 1a816b7 commit 22fca46

File tree

11 files changed

+2293
-0
lines changed

11 files changed

+2293
-0
lines changed

dist/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Jesús Manuel Germade Castiñeiras <jesus@germade.es>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

dist/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
# http-rest
3+
4+
`ajax / http` wrapper for browser and node that allows config inheritance ( uses [fetch API](https://developer.mozilla.org/es/docs/Web/API/Fetch_API) when present )
5+
6+
[![npm](https://img.shields.io/npm/v/http-rest.svg)](https://www.npmjs.com/package/http-rest) [![bower](https://img.shields.io/bower/v/http-rest.svg)](http://bower.io/search/?q=http-rest)
7+
[![Build Status](https://travis-ci.org/kiltjs/http-rest.svg?branch=master)](https://travis-ci.org/kiltjs/http-rest)
8+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9+
10+
### Installation
11+
12+
> Node module
13+
14+
``` sh
15+
npm install http-rest --save
16+
```
17+
``` js
18+
var $http = require('http-rest');
19+
```
20+
21+
> Browser using node bundler
22+
23+
``` js
24+
var $http = require('http-rest/browser');
25+
26+
// if you want to use fetch API when present
27+
var $http = require('http-rest/fetch');
28+
```
29+
30+
> Browser using bower
31+
32+
``` sh
33+
bower install http-rest --save
34+
```
35+
36+
``` js
37+
// if you want to use fetch API when present (in bower.json)
38+
// ...
39+
"overrides": {
40+
"http-rest": {
41+
"main": "dist/fetch.js"
42+
}
43+
},
44+
// ...
45+
```
46+
47+
48+
### Usage
49+
50+
``` js
51+
// GET .../items?prop1=value1
52+
$http.get('/items', { params: { prop1: value1 } });
53+
54+
$http.post('/items', {
55+
sample: 'payload'
56+
});
57+
58+
$http.put('/items/:itemId', {
59+
sample: 'payload'
60+
});
61+
62+
$http.patch('/items/:itemId', {
63+
sample: 'payload'
64+
});
65+
66+
$http.delete('/items/:itemId');
67+
```
68+
69+
### Base configurations
70+
71+
``` js
72+
var httpItems = $http.base('items');
73+
74+
httpItems.post({ prop1: 'value1' });
75+
76+
httpItems.get(itemId);
77+
78+
httpItems.put(itemId, { prop1: 'another value' });
79+
80+
httpItems.delete(itemId);
81+
```

0 commit comments

Comments
 (0)