テストおよびデバッグする
JavaScript 関数をローカルで実行し、HTTP 経由で呼び出して、ジョブとして実行し、パブリッシュ前にパッケージ化されたプロジェクトを検証します。
関数は、プラットフォームが使用する同じランタイムとルーティングに対して、パッケージ化される前にローカルで実行されます。
サーブしてコール
uip function serve
uip function serve
ホット・リロード・サーバーをポート 7070 で起動します。 --port 変更します。すべてのHTTP関数は、宣言されたパスで呼び出され、ルートURLは登録されているルートをリストします。
宣言されたパスで curl を持つサーブされた関数を呼び出します。
curl -X POST http://localhost:7070/hello \
-H "Content-Type: application/json" \
-d '{"name":"Alice"}'
curl -X POST http://localhost:7070/hello \
-H "Content-Type: application/json" \
-d '{"name":"Alice"}'
serveまた、ランタイム、node、または denoを選択するのにも--runtime時間がかかります。
ジョブとして実行する
uip function run process-order --input '{"orderId":"A-1"}'
uip function run process-order --input '{"orderId":"A-1"}'
run runs the function once, the way the platform runs a job, and prints a JobResult with the status and the output arguments. It doesn't need serve. ctx.params and ctx.headers are empty, as in a deployed job. Use run to test job functions, and serve to test HTTP functions. Pass --input-file to read the input from a JSON file.
Orchestrator をローカルにアクセスする
ctx.robot はローカル実行で null され、 ctx.platform は環境変数から構築されます。それらをプロジェクトのルートにある .env ファイルに書き込みます。
UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>
UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>
serve loads that file. Exporting the variables in your shell works too.
Running in production mode
serve --production and run --production start the project the way the platform does, without hot reload. See the CLI reference for details.