1.0.25 • Published 6 years ago

@kilt/http v1.0.25

Weekly downloads
53
License
MIT
Repository
github
Last release
6 years ago

http-rest

ajax / http wrapper for browser and node that allows config inheritance ( uses fetch API when present )

ᴋɪʟᴛ ᴊs npm Build Status GitHub license

Installation

Node module

npm install @kilt/http --save
var $http = require('http-rest');

Browser using node bundler

var $http = require('http-rest/browser');

// if you want to use fetch API when present
var $http = require('http-rest/fetch');

Browser using bower

bower install http-rest --save
// if you want to use fetch API when present (in bower.json)
// ...
"overrides": {
  "http-rest": {
    "main": "dist/fetch.js"
  }
},
// ...

Usage

// GET .../items?prop1=value1
$http.get('/items', { params: { prop1: value1 } });

$http.post('/items', {
  sample: 'payload'
});

$http.put('/items/:itemId', {
  sample: 'payload'
});

$http.patch('/items/:itemId', {
  sample: 'payload'
});

$http.delete('/items/:itemId');

Base configurations

var http_items = $http.base('items');

http_items.post({ prop1: 'value1' });

http_items.get(itemId);

http_items.put(itemId, {  prop1: 'another value' });

http_items.delete(itemId);
1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago