|
2 | 2 | [](https://nodei.co/npm/catberry-uhr/) |
3 | 3 |
|
4 | 4 | ##Description |
5 | | -Catberry's modules run both at server and browser and it is very useful to have universal http(s) request implementation. |
| 5 | +Catberry's modules run both at server and in browser and it is very useful to |
| 6 | +have universal http(s) request implementation. |
6 | 7 |
|
7 | | -It has one interface and different implementations on server and browser. |
| 8 | +It has one interface and different implementations at server and in browser. |
8 | 9 |
|
9 | | -At server it uses node's "http.request" or "https.request" (depend on specified protocol in URL). |
| 10 | +At server it uses node's "http.request" or "https.request" |
| 11 | +(depend on specified protocol in URL). |
10 | 12 | At browser it uses native XmlHttpRequest. |
11 | 13 |
|
12 | | -This module was developed using [HTTP/1.1v2 RFC 2616](http://www.w3.org/Protocols/rfc2616). |
| 14 | +This module was developed using [HTTP/1.1v2 RFC 2616] |
| 15 | +(http://www.w3.org/Protocols/rfc2616). |
13 | 16 |
|
14 | 17 | It supports: |
15 | 18 |
|
@@ -72,6 +75,7 @@ Options support: |
72 | 75 |
|
73 | 76 | ```javascript |
74 | 77 | { |
| 78 | + method: 'GET', |
75 | 79 | timeout: 30000, |
76 | 80 | headers: { |
77 | 81 | Cookie: 'name=value' |
@@ -106,38 +110,10 @@ Status object looks like this: |
106 | 110 | ``` |
107 | 111 |
|
108 | 112 | ##Usage |
109 | | -To use this module you must register its components into catberry's [Service Locator](https://github.com/pragmadash/catberry-locator) like this: |
| 113 | +If you are using [Catberry Framework](https://github.com/pragmadash/catberry) |
| 114 | +it is already included and registered in Service Locator. |
110 | 115 |
|
111 | | -In server.js |
112 | | - |
113 | | -```javascript |
114 | | -var uhr = require('catberry-uhr'), |
115 | | - catberry = require('catberry'), |
116 | | - config = require('./config-server'), |
117 | | - app = connect(); |
118 | | - cat = catberry.create(config); |
119 | | - |
120 | | -// register UHR components |
121 | | -uhr.registerOnServer(cat.locator); |
122 | | - |
123 | | -app.use(cat.getMiddleware()); |
124 | | -... |
125 | | -``` |
126 | | - |
127 | | -In client.js |
128 | | - |
129 | | -```javascript |
130 | | -var uhr = require('catberry-uhr'), |
131 | | - catberry = require('catberry'), |
132 | | - config = require('./config-client'), |
133 | | - cat = catberry.create(config); |
134 | | - |
135 | | -// register localization components in locator |
136 | | -uhr.registerOnClient(cat.locator); |
137 | | - |
138 | | -``` |
139 | | - |
140 | | -And then you can just inject $uhr into you module and use like this: |
| 116 | +You can just inject $uhr into you module and use like this: |
141 | 117 |
|
142 | 118 | ```javascript |
143 | 119 | function Module($uhr) { |
@@ -167,11 +143,16 @@ Module.prototype.render(placeholderName, args, callback) { |
167 | 143 | ``` |
168 | 144 |
|
169 | 145 | ##Contribution |
170 | | -If you have found a bug, please create pull request with mocha unit-test which reproduces it or describe all details in issue if you can not implement test. |
171 | | -If you want to propose some improvements just create issue or pull request but please do not forget to use **npm test** to be sure that you code is awesome. |
| 146 | +If you have found a bug, please create pull request with [mocha] |
| 147 | +(https://www.npmjs.org/package/mocha) unit-test which reproduces it or describe |
| 148 | +all details in issue if you can not implement test. If you want to propose some |
| 149 | +improvements just create issue or pull request but please do not forget to use |
| 150 | +`npm test` to be sure that your code is awesome. |
172 | 151 |
|
173 | | -All changes should satisfy this [Code Style Guide](https://github.com/pragmadash/catberry/blob/master/docs/code-style.md). |
| 152 | +All changes should satisfy this [Code Style Guide] |
| 153 | +(docs/code-style-guide.md). |
174 | 154 |
|
175 | | -Also your changes should be covered by unit tests using [mocha](https://www.npmjs.org/package/mocha). |
| 155 | +Also your changes should be covered by unit tests using [mocha] |
| 156 | +(https://www.npmjs.org/package/mocha). |
176 | 157 |
|
177 | | -Denis Rechkunov <denis.rechkunov@gmail.com> |
| 158 | +Denis Rechkunov <denis.rechkunov@gmail.com> |
0 commit comments