Skip to content

Commit

Permalink
docs: Minor fixes in Transport example readme (#199)
Browse files Browse the repository at this point in the history
* docs: Fixes typos, adds instructions

* docs: adds .md bash syntax highlight
  • Loading branch information
joaosantos15 authored and daviddias committed Jun 4, 2018
1 parent abc6257 commit 1790ded
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions examples/transports/README.md
Expand Up @@ -12,7 +12,7 @@ When using libp2p, you always want to create your own libp2p Bundle, that is, pi

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

```
```bash
> npm install libp2p libp2p-tcp peer-info async
```

Expand Down Expand Up @@ -76,7 +76,7 @@ waterfall([
})
```

Running this should result in somehting like:
Running this should result in something like:

```bash
> node 1.js
Expand All @@ -98,6 +98,12 @@ For this step, we will need one more dependency.
> npm install pull-stream
```

And we also need to import the module on our .js file:

```js
const pull = require('pull-stream')
```

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.

```JavaScript
Expand All @@ -118,11 +124,18 @@ function printAddrs (node, number) {
console.log('node %s is listening on:', number)
node.peerInfo.multiaddrs.forEach((ma) => console.log(ma.toString()))
}

```

Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other.
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`:

```js
const parallel = require('async/parallel')
```

Then,

```js
parallel([
(cb) => createNode(cb),
(cb) => createNode(cb)
Expand Down Expand Up @@ -172,7 +185,7 @@ What we are going to do in this step is to create 3 nodes, one with TCP, another

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

```sh
```bash
> npm install libp2p-websockets
```

Expand Down

0 comments on commit 1790ded

Please sign in to comment.