Skip to content

Commit dcf6f77

Browse files
committed
address pr feedback & tweaks
1 parent 5d587b5 commit dcf6f77

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

docs/basics/js/js-ipfs.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,29 +180,46 @@ The JS-IPFS implementation is split into several Node.js modules. The following
180180
181181
This imports the client library and uses the `create()` function to connect to an IPFS API server.
182182
183-
1. To connect to the API, run the application: <!--TODO: complete -->
183+
1. To connect to the API, run the application:
184+
185+
```bash
186+
node index.js
187+
```
188+
189+
The library internally detects if your machine is running a local node.
184190
185191
:::
186192
187193
::: tab ipfs-client id="connect-ipfs-client"
188194
189-
1. If you have not already installed the client library, add the `ipfs-http-client` module to your project: <!--TODO: complete -->
190-
1. Populate your `index.js` file with the following to create an instance of the HTTP API client:
195+
1. If you have not already installed the client library, add the `ipfs-client` module to your project:
196+
197+
```bash
198+
npm i ipfs-client
199+
```
200+
201+
2. Populate your `index.js` file with the following to create an instance of the HTTP API client:
191202
192203
```js{1,3-5}
193204
import { create } from 'ipfs-client'
194205
195206
const client = create({
196-
grpc: '/ipv4/127.0.0.1/tcp/5003/ws',
197-
http: '/ipv4/127.0.0.1/tcp/5002/http'
207+
grpc: '/ip4/127.0.0.1/tcp/5003/ws',
208+
http: '/ip4/127.0.0.1/tcp/5002/http'
198209
})
199210
200211
const id = await client.id()
201212
```
202213
203214
This imports the client library and uses the `create()` function to define the server endpoints.
204215
205-
1. To connect to the endpoints, run the application: <!-- TODO: complete -->
216+
3. To connect to the endpoints, run the application:
217+
218+
```bash
219+
node index.js
220+
```
221+
222+
The library internally detects if your machine is running a local node that leverages the specified connections.
206223
207224
:::
208225

0 commit comments

Comments
 (0)