Skip to content

Commit cc19c93

Browse files
ronaldl29dzikowski
andauthored
Added Fablo Sample Gateway Connection for Node.js (hyperledger-labs#541)
Signed-off-by: Ronald L <ronaldlong46@icloud.com> Co-authored-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
1 parent f8d519c commit cc19c93

File tree

5 files changed

+524
-0
lines changed

5 files changed

+524
-0
lines changed

samples/gateway/node/.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CHANNEL_NAME=my-channel1
2+
CONTRACT_NAME=chaincode1
3+
PEER_GATEWAY_URL=localhost:7041
4+
PEER_ORG_NAME=peer0.org1.example.com
5+
MSP_ID=Org1MSP
6+
TLS_ROOT_CERT=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
7+
CREDENTIALS=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
8+
PRIVATE_KEY_PEM=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv-key.pem
9+

samples/gateway/node/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Purpose
2+
To provide an example connection of Fablo with Node.js.
3+
4+
# Pre-requisites
5+
Docker
6+
7+
Node >22
8+
9+
Git
10+
11+
# Instructions
12+
1. (If Fablo is not already installed) Clone the Fablo repo with `https://github.com/hyperledger-labs/fablo.git` and then `cd fablo`.
13+
2. Start Docker.
14+
3. Run `fablo up samples/fablo-config-hlf3-1orgs-1chaincode.json`.
15+
4. Once Fablo is running, run `cd samples/gateway/node`.
16+
5. Now install the Node server's dependencies with `npm i`.
17+
6. Now let's copy the environment example to a usable file `cp .env.example .env`.
18+
7. Start the node server with `node --env-file=.env server.js`.
19+
20+
You should see a response like this:
21+
```
22+
Put result: {"success":"OK"}
23+
Get result: {"success":"2025-04-29T16:13:42.097Z"}`
24+
```
25+

0 commit comments

Comments
 (0)