在另一个端口上运行composer-rest-server?

时间:2017-07-24 13:55:15

标签: hyperledger-composer

默认情况下,它从3000开始,由另一个进程使用。

有没有办法让它在不同的端口上运行?

~/git/my-test-network$ composer-rest-server -p hlfv1 -n my-test-network -i admin -s adminpw -N never
Discovering types from business network definition ...
Discovered types from business network definition
Generating schemas for all types in business network definition ...
Generated schemas for all types in business network definition
Adding schemas for all types to Loopback ...
Added schemas for all types to Loopback
events.js:160
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE 0.0.0.0:3000
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at Server._listen2 (net.js:1258:14)
at listen (net.js:1294:10)
at net.js:1404:9
at _combinedTickCallback (internal/process/next_tick.js:83:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

3 个答案:

答案 0 :(得分:6)

使用-P标志。

daniels-mbp-2:composer-common dselman$ composer-rest-server --help
Usage: composer-rest-server [options]

Options:
  -p, --connectionProfileName  The connection profile name  [string]
  -n, --businessNetworkName    The business network identifier  [string]
  -i, --enrollId               The enrollment ID of the user  [string]
  -s, --enrollSecret           The enrollment secret of the user  [string]
  -N, --namespaces             Use namespaces if conflicting types exist  [string] [choices: "always", "required", "never"] [default: "always"]
  -P, --port                   The port to serve the REST API on  [number]
  -S, --security               Enable security for the REST API  [boolean] [default: false]
  -h, --help                   Show help  [boolean]
  -v, --version                Show version number  [boolean]

答案 1 :(得分:1)

以下命令将在最新版本0.20上运行

composer-rest-server -c admin@mynetwork -n never -w true -p 3001

答案 2 :(得分:0)

从0.20版开始,端口标志为-p(小写)