You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-13
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ This repository does not publish npm packages **yet**.
32
32
One service acts as a `Server` providing data and another as a `Client` requesting data.
33
33
34
34
```javascript
35
-
consttaube=require('@cloud/taube')
35
+
importtaubefrom'@cloud/taube'
36
36
taube.http.init()
37
37
38
38
constserver=newtaube.Server({})
@@ -52,7 +52,7 @@ server.get(
52
52
Any Client can now request data:
53
53
54
54
```javascript
55
-
consttaube=require('@cloud/taube')
55
+
importtaubefrom'@cloud/taube'
56
56
57
57
constclient=newtaube.Client({
58
58
uri:'http://scooter'
@@ -70,7 +70,7 @@ The `Client` and `Server` components mimic the standard way of sending and routi
70
70
`Client` component is a wrapper around [got](https://github.com/sindresorhus/got) that exposes different http methods to send a request.
// Creating the requester needs to be one of the first things in your application
273
273
// Assuming that a Responder with the given key is set up on the given uri
@@ -301,7 +301,6 @@ The `url` option needs to include `http` or `https` without a `/` at the end.
301
301
| Variable | Default | Description
302
302
| ------------------ |:----------------:| ---
303
303
| TAUBE_HTTP_PORT | 4321 | Port of http server
304
-
| TAUBE_DEBUG | undefined | Adds debugging information to Taube responses. See tests for usage. This does change responses and is only designed for development.
305
304
| TAUBE_UNIT_TESTS | undefined | If set all requesters default their uri to <http://localhost>
306
305
| TAUBE_RETRIES | 3 | Number of retries any Requester does before giving up. 3 is maximum value as retry duration would be over timeout.
307
306
| TAUBE_JSON_SIZE_LIMIT |500kb | Size limit for JSON file
@@ -311,15 +310,15 @@ The `url` option needs to include `http` or `https` without a `/` at the end.
311
310
@infrastructure/observability can be used to get readiness/liveness checks and signal handling for the taube http server.
@@ -548,7 +547,7 @@ And there are two ways of throwing a taube error instance.
548
547
#### Throwing an error using constructor name
549
548
550
549
```javascript
551
-
const { Errors } =require('@cloud/taube')
550
+
import { Errors } from'@cloud/taube'
552
551
553
552
// joi/celebrate validation error
554
553
if(VALIDATION_FAILURE) {
@@ -561,7 +560,7 @@ if(VALIDATION_FAILURE) {
561
560
#### Throwing an error using statusCode
562
561
563
562
```javascript
564
-
const { Errors } =require('@cloud/taube')
563
+
import { Errors } from'@cloud/taube'
565
564
566
565
// your code
567
566
if(!scooter) {
@@ -660,6 +659,8 @@ A few tests need to run before any other. These tests are prefixed by 0.X. Do no
660
659
661
660
## Migrate from cote
662
661
662
+
You will have to install taube at version 2. `npm install @cloud/taube@2` to follow this part.
663
+
663
664
Version 0.X is designed to have a clear migration path to remove cote. Taube 0.X is a drop in replacement for cote. Without configuration it functions as a wrapper to cote and keeps using cote for communication. It also sets up http Responders, which means the service using Taube can be targeted by Taube Requesters.
664
665
665
666
There is 3 modes you can run taube in while migrating from cote to taube.
@@ -728,8 +729,8 @@ Remove this function call to migrate to v4.
728
729
729
730
This will be required for most Services. Add it after requiring taube in your index.js:
0 commit comments