Skip to content

Commit 1790ded

Browse files
joaosantos15daviddias
authored andcommitted
docs: Minor fixes in Transport example readme (#199)
* docs: Fixes typos, adds instructions * docs: adds .md bash syntax highlight
1 parent abc6257 commit 1790ded

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

examples/transports/README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ When using libp2p, you always want to create your own libp2p Bundle, that is, pi
1212

1313
You will need 4 deps total, so go ahead and install all of them with:
1414

15-
```
15+
```bash
1616
> npm install libp2p libp2p-tcp peer-info async
1717
```
1818

@@ -76,7 +76,7 @@ waterfall([
7676
})
7777
```
7878

79-
Running this should result in somehting like:
79+
Running this should result in something like:
8080

8181
```bash
8282
> node 1.js
@@ -98,6 +98,12 @@ For this step, we will need one more dependency.
9898
> npm install pull-stream
9999
```
100100

101+
And we also need to import the module on our .js file:
102+
103+
```js
104+
const pull = require('pull-stream')
105+
```
106+
101107
We are going to reuse the MyBundle class from step 1, but this time to make things simpler, we will create two functions, one to create nodes and another to print the addrs to avoid duplicating code.
102108

103109
```JavaScript
@@ -118,11 +124,18 @@ function printAddrs (node, number) {
118124
console.log('node %s is listening on:', number)
119125
node.peerInfo.multiaddrs.forEach((ma) => console.log(ma.toString()))
120126
}
127+
121128
```
122129

123-
Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other.
130+
Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other. We already added `async` as a dependency, but still need to import `async/parallel`:
124131

132+
```js
133+
const parallel = require('async/parallel')
125134
```
135+
136+
Then,
137+
138+
```js
126139
parallel([
127140
(cb) => createNode(cb),
128141
(cb) => createNode(cb)
@@ -172,7 +185,7 @@ What we are going to do in this step is to create 3 nodes, one with TCP, another
172185

173186
In this example, we will need to also install `libp2p-websockets`, go ahead and install:
174187

175-
```sh
188+
```bash
176189
> npm install libp2p-websockets
177190
```
178191

0 commit comments

Comments
 (0)