Прокси-клиент для доступа к функциям модуля без получения нового токена¶
Подключение клиента осуществляется в modules.registry.globals.di
в deploy.json
:
{
"modules": {
"registry": {
"globals": {
"di":{
"apiGateWay": {
"module": "modules/rest/client/GateWay",
"options": {
"log": "ion://sysLog",
"base": "/registry-ajax-api",
"clientId": "ext@system",
"clientSecret": "ion-demo",
"tokenPath": "/rest/token",
"endPoint": "[[rest.endPoint]]",
"definition": {
"paths": {
"/rest/echo-token": {
"post": true,
"get": true
}
}
}
}
}
Пример запроса к rest/echo-token через прокси-клиент:
curl -X POST --cookie-jar 1.txt -d username="demo@local" -d password="ion-demo" http://localhost:8888/auth
curl -X GET --cookie 1.txt https://dnt.iondv.com/registry-ajax-api/rest/echo-token
пример запроса в dnt: test/modules/rest/gateway.spec.js
/Checking rest-api proxy