1
1
<img src =" https://raw.githubusercontent.com/js-data/js-data/master/js-data.png " alt =" js-data logo " title =" js-data " align =" right " width =" 64 " height =" 64 " />
2
2
3
- ## js-data-http [ ![ bower version ] ( https://img.shields.io/bower/v/js-data-http.svg?style=flat-square )] ( https://www.npmjs.org/package/js-data-http ) [ ![ npm version] ( https://img.shields.io/npm/v/js-data-http.svg?style=flat-square )] ( https://www.npmjs.org/package/js-data-http ) [ ![ Circle CI] ( https://img.shields.io/circleci/project/js-data/js-data-http/master.svg?style=flat-square )] ( https://circleci.com/gh/js-data/js-data-http/tree/master ) [ ![ npm downloads] ( https://img.shields.io/npm/dm/js-data-http.svg?style=flat-square )] ( https://www.npmjs.org/package/js-data-http ) [ ![ License ] ( https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square )] ( https://github.com/js-data/js-data-http/blob/master/LICENSE )
3
+ ## js-data-http [ ![ Slack Status ] [ sl_b ]] [ sl_l ] [ ![ npm version] [ npm_b ]] [ npm_l ] [ ![ Circle CI] [ circle_b ]] [ circle_l ] [ ![ npm downloads] [ dn_b ]] [ dn_l ] [ ![ Coverage Status ] [ cov_b ]] [ cov_l ] [ ![ Codacy ] [ cod_b ]] [ cod_l ]
4
4
5
+ HTTP adapter for [ js-data] ( http://www.js-data.io/ ) .
5
6
6
- http adapter for [ js-data] ( http://www.js-data.io/ ) .
7
+ The ` js-data-http ` npm package is for use in the Browser, and the ` js-data-http-node `
8
+ package is for use in Node.js.
7
9
8
10
### API Documentation
9
11
[ DSHttpAdapter] ( http://www.js-data.io/docs/dshttpadapter )
10
12
11
- __ Latest Release: __ [ ![ Latest Release ] ( https://img.shields.io/github/release/js-data/js-data-http.svg?style=flat-square )] ( https://github.com/js-data/js-data-http/releases )
13
+ ### Quick Start
12
14
13
- __ Status: __
15
+ #### Browser
14
16
15
- [ ![ Dependency Status ] ( https://img.shields.io/gemnasium/js-data/js-data-http.svg?style=flat-square )] ( https://gemnasium.com/ js-data/ js-data-http) [ ![ Coverage Status ] ( https://img.shields.io/coveralls/js-data/js-data-http/master.svg?style=flat-square )] ( https://coveralls.io/r/ js-data/js-data-http?branch=master ) [ ![ Codacity ] ( https://img.shields.io/codacy/3931bbd8d838463297f70640aa78251b.svg?style=flat-square )] ( https://www.codacy.com/public/jasondobry/ js-data-http/dashboard )
17
+ ` bower install --save js-data js-data-http` or ` npm install --save js-data js-data-http` .
16
18
17
- __ Supported Platforms: __
19
+ __ ES6 __
18
20
19
- [ ![ node version] ( https://img.shields.io/badge/Node-0.10%2B-green.svg?style=flat-square )] ( https://github.com/js-data/js-data ) [ ![ browsers] ( https://img.shields.io/badge/Browser-Chrome%2CFirefox%2CSafari%2COpera%2CIE%209%2B%2CiOS%20Safari%207.1%2B%2CAndroid%20Browser%202.3%2B-green.svg?style=flat-square )] ( https://github.com/js-data/js-data )
21
+ ``` js
22
+ const adapter = new DSHttpAdapter ()
20
23
21
- ### Quick Start
22
- ` bower install --save js-data js-data-http ` or ` npm install --save js-data js-data-http ` .
24
+ class Base extends JSData .Model {}
25
+ Base .registerAdapter (' http' , adapter, { default: true })
26
+
27
+ class School extends Model {}
28
+ class Student extends Model {}
29
+
30
+ // "School" and "Student" will now use the http adapter by default
31
+ ```
32
+
33
+ __ ES5__
34
+
35
+ ``` js
36
+ var adapter = new DSHttpAdapter ()
37
+
38
+ var Base = JSData .Model .extend ({}, { name: ' Base' })
39
+ Base .registerAdapter (' http' , adapter, { default: true })
40
+
41
+ var School = Base .extend ({}, { name: ' School' })
42
+ var Student = Base .extend ({}, { name: ' Student' })
43
+
44
+ // "School" and "Student" will now use the http adapter by default
45
+ ```
46
+
47
+ #### Node.js
23
48
24
- Load ` js-data-http.js ` after ` js-data.js ` .
49
+ ` npm install --save axios js-data js-data-http-node `
50
+
51
+ __ ES6__
52
+
53
+ ``` js
54
+ import {Model } from ' js-data'
55
+ import DSHttpAdapter from ' js-data-http-node'
56
+
57
+ const adapter = new DSHttpAdapter ()
58
+
59
+ class Base extends Model {}
60
+ Base .registerAdapter (' http' , adapter, { default: true })
61
+
62
+ class School extends Model {}
63
+ class Student extends Model {}
64
+
65
+ // "School" and "Student" will now use the http adapter by default
66
+ ```
67
+
68
+ __ ES5__
25
69
26
70
``` js
27
- var adapter = new DSHttpAdapter ();
71
+ var JSData = require (' js-data' )
72
+ var Model = JSData .Model
73
+ var DSHttpAdapter = require (' js-data-http-node' )
74
+
75
+ var adapter = new DSHttpAdapter ()
28
76
29
- var store = new JSData.DS ();
30
- store .registerAdapter (' http' , adapter, { default: true });
77
+ var Base = Model . extend ({}, { name : ' Base ' })
78
+ Base .registerAdapter (' http' , adapter, { default: true })
31
79
32
- // "store" will now use the http adapter for all async operations
80
+ var School = Base .extend ({}, { name: ' School' })
81
+ var Student = Base .extend ({}, { name: ' Student' })
82
+
83
+ // "School" and "Student" will now use the http adapter by default
33
84
```
34
85
35
86
### Changelog
36
87
[ CHANGELOG.md] ( https://github.com/js-data/js-data-http/blob/master/CHANGELOG.md )
37
88
38
89
### Community
39
- - [ Gitter Channel] ( https://gitter.im/js-data/js-data ) - Better than IRC!
90
+ - [ Slack Channel] [ sl_l ] - Better than IRC!
40
91
- [ Announcements] ( http://www.js-data.io/blog )
41
92
- [ Mailing List] ( https://groups.io/org/groupsio/jsdata ) - Ask your questions!
42
93
- [ Issues] ( https://github.com/js-data/js-data-http/issues ) - Found a bug? Feature request? Submit an issue!
@@ -45,16 +96,35 @@ store.registerAdapter('http', adapter, { default: true });
45
96
46
97
### Contributing
47
98
48
- First, feel free to contact me with questions. [ Mailing List] ( https://groups.io/org/groupsio/jsdata ) . [ Issues] ( https://github.com/js-data/js-data-http/issues ) .
99
+ First, support is handled via the [ Slack Channel] [ sl_l ] and the
100
+ [ Mailing List] [ ml ] . Ask your questions there.
101
+
102
+ When submitting issues on GitHub, please include as much detail as possible to
103
+ make debugging quick and easy.
49
104
50
- 1 . Contribute to the issue that is the reason you'll be developing in the first place
105
+ - good - Your versions of js-data, js-data-http, etc., relevant console logs/error,
106
+ code examples that revealed the issue
107
+ - better - A [ plnkr] ( http://plnkr.co/ ) , [ fiddle] ( http://jsfiddle.net/ ) , or
108
+ [ bin] ( http://jsbin.com/?html,output ) that demonstrates the issue
109
+ - best - A Pull Request that fixes the issue, including test coverage for the
110
+ issue and the fix
111
+
112
+ [ Github Issues] ( https://github.com/js-data/js-data/issues ) .
113
+
114
+ #### Pull Requests
115
+
116
+ 1 . Contribute to the issue/discussion that is the reason you'll be developing in
117
+ the first place
51
118
1 . Fork js-data-http
52
- 1 . ` git clone https:// github.com/ <you>/js-data-http.git `
119
+ 1 . ` git clone git@ github.com: <you>/js-data-http.git `
53
120
1 . ` cd js-data-http; npm install; bower install; `
54
- 1 . ` grunt go ` (builds and starts a watch)
55
- 1 . (in another terminal) ` grunt karma:dev ` (runs the tests)
56
121
1 . Write your code, including relevant documentation and tests
57
- 1 . Submit a PR and we'll review
122
+ 1 . Run ` npm test ` (build and test)
123
+ 1 . Your code will be linted and checked for formatting, the tests will be run
124
+ 1 . The ` dist/ ` folder & files will be generated, do NOT commit ` dist/* ` ! They
125
+ will be committed when a release is cut.
126
+ 1 . Submit your PR and we'll review!
127
+ 1 . Thanks!
58
128
59
129
### License
60
130
@@ -80,3 +150,16 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80
150
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
81
151
SOFTWARE.
82
152
153
+ [ sl_b ] : http://slack.js-data.io/badge.svg
154
+ [ sl_l ] : http://slack.js-data.io
155
+ [ npm_b ] : https://img.shields.io/npm/v/js-data-http.svg?style=flat
156
+ [ npm_l ] : https://www.npmjs.org/package/js-data-http
157
+ [ circle_b ] : https://img.shields.io/circleci/project/js-data/js-data-http/master.svg?style=flat
158
+ [ circle_l ] : https://circleci.com/gh/js-data/js-data-http/tree/master
159
+ [ dn_b ] : https://img.shields.io/npm/dm/js-data-http.svg?style=flat
160
+ [ dn_l ] : https://www.npmjs.org/package/js-data-http
161
+ [ cov_b ] : https://img.shields.io/coveralls/js-data/js-data-http/master.svg?style=flat
162
+ [ cov_l ] : https://coveralls.io/github/js-data/js-data-http?branch=master
163
+ [ cod_b ] : https://img.shields.io/codacy/3931bbd8d838463297f70640aa78251b.svg
164
+ [ cod_l ] : https://www.codacy.com/app/jasondobry/js-data-http/dashboard
165
+
0 commit comments