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
{{ message }}
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
## Install the general purpose Composer REST Server
48
48
49
-
We need to install LoopBack; this is two npm modules `loopback` and `loopback-cli`.
49
+
We need to install the Fabric Composer REST server; this is an npm module named `composer-rest-server``.
50
50
51
-
>You might need to issue both of these using sudo.
51
+
>You might need to issue this command using sudo.
52
52
53
53
```bash
54
-
npm install -g loopback
55
-
npm install -g loopback-cli
54
+
npm install -g composer-rest-server
56
55
```
57
56
58
-
## Creating the LoopBack server application
59
-
60
-
We need to have a LoopBack server running to serve the REST api. As this is an application itself, it's worth creating a new directory for this. So assuming you're still in the Getting Started directory create a new directory as follows.
61
-
62
-
```bash
63
-
cd ..
64
-
mkdir loopback-server
65
-
cd loopback-server
66
-
```
67
-
68
-
You can now create the loop back server. Issue the command `lb` in this new directory. This is the output you'll see together with the answers to the questions you'll be asked.
69
-
57
+
## Running the REST server
58
+
You should now be able to run the Fabric Composer REST server.
70
59
```bash
71
-
$ lb
72
-
73
-
_-----_
74
-
|| ╭──────────────────────────╮
75
-
|--(o)--| │ Let's create a LoopBack │
76
-
`---------´ │ application! │
77
-
( _´U`_ ) ╰──────────────────────────╯
78
-
/___A___\ /
79
-
| ~ |
80
-
__'.___.'__
81
-
´ ` |° ´ Y `
82
-
83
-
? What's the name of your application? rest
84
-
? Which version of LoopBack would you like to use? 2.x (long term support)
85
-
? What kind of application do you have in mind? api-server (A LoopBack API server with local User auth)
86
-
Generating .yo-rc.json
87
-
88
-
89
-
I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.
90
-
91
-
92
-
create .editorconfig
93
-
create .eslintignore
94
-
create .eslintrc
95
-
create server/boot/root.js
96
-
create server/middleware.development.json
97
-
create server/middleware.json
98
-
create server/server.js
99
-
create README.md
100
-
create server/boot/authentication.js
101
-
create .gitignore
102
-
create client/README.md
103
-
60
+
composer-rest-server
104
61
```
105
62
106
-
That is now all created - the next step is to add an adapter to link with the Fabric Composer runtime.
63
+
You will then be asked to enter a few simple details about your business network.
107
64
108
65
```bash
109
-
npm install --save loopback-connector-composer
110
-
```
111
-
112
-
Last step before trying things out is to add a function in the `server/boot` boot directory. This function is below - the key parts are in the `datasource` variable. These have been filled out with the same settings of the Getting Started guide.
113
-
Create a new file in this directory with the following contents, the name of the file is not important, so for example `loopback-composer.js`.
? Enter your Fabric Connection Profile Name: defaultProfile
73
+
? Enter your Business Network Identifier : digitalproperty-network
74
+
? Enter your Fabric username : WebAppAdmin
75
+
? Enter your secret: DJY27pEnl16d
76
+
WARNING: No configurations found in configuration directory:/Users/samsmith/Projects/BlockChain/Composer/fabric-composer/packages/composer-rest-server/config
165
77
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
? Enter your Fabric Connection Profile Name: defaultProfile
58
+
? Enter your Business Network Identifier : digitalproperty-network
59
+
? Enter your Fabric username : WebAppAdmin
60
+
? Enter your secret: DJY27pEnl16d
61
+
WARNING: No configurations found in configuration directory:/Users/samsmith/Projects/BlockChain/Composer/fabric-composer/packages/composer-rest-server/config
62
+
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
63
+
Loopback Connector for Fabric Composer
64
+
Models Loaded Now
65
+
Browse your REST API at http://0.0.0.0:3000/explorer
66
+
```
67
+
68
+
## Non-Interactive Mode
69
+
70
+
Alternatively you can run the server specifying all the parameters on the command line
Browse your REST API at http://0.0.0.0:3000/explorer
76
+
```
77
+
78
+
## Looking at the generated APIs
79
+
80
+
Launch your browser and go to the URL given (http://0.0.0.0:3000/explorer)
81
+
82
+
You will be able to inspect and execute the APIs that are generated from the Business Network.
83
+
84
+
85
+
## Debug
86
+
87
+
If you should encounter any issues when using the composer-rest-server then you can use the following environment variable to enable extra trace information.
0 commit comments