Configuring the API Gateway
All configuration for the API gateway is in the file /ApiGateway/config.json
.
Keycloak
To configure the Keycloak server used for authentication, please update the auth-server-url
property:
"auth-server-url": "http://localhost:8080/"
API Services
API services that are handled by the API gateway must have a config entry in the services
property like the following:
{
"serviceName": "example",
"incomingRoute": "/example/*",
"baseUrl": "http://localhost:8080",
"getHandler": "genericGet",
"postHandler": "genericPost",
"putHandler": "genericPut",
"forwardHeaders": ["*"],
"headers": {},
"queryStrings": {}
}
Where the config entry has the following properties:
Property | Description |
---|---|
serviceName | The name of the API service. |
comment | The description of the API service (optional). |
incomingRoute | The incoming request path (to the API gateway). The wildcard character * can be used. |
baseUrl | The API domain name and port to which the request should be forwarded. |
getHandler | The method to handle GET requests to the API. Use genericGet by default. |
postHandler | The method to handle POST requests to the API. Use genericPost by default. |
putHandler | The method to handle PUT requests to the API. Use genericPut by default. |
forwardHeaders | List of header keys to be forwarded. The wildcard character * can be used to forward all headers. |
headers | Additional key/value pairs for headers to be added to the request. |
queryStrings | Additional key/value pairs for request paramaters to be added to the request URL. |
Port Number
By default the API gateway uses port 8085. If you need to change this for some reason, please update the port number in the following locations:
port
property in/ApiGateway/config.json
TESERVER
property in/TemenosExplorer/public/TA_config.js
(i)LOGURL
property in/TemenosExplorer/public/TA_config.js
(i)- Any plugin specific properties/URLs which reference the API gateway
(i) See/consider ConfigServlet if Temenos Exporer is going to be deployed as a WAR
Building the API Gateway
After cloning the repository to your local machine you will need to build the API gateway before you can use it. To build the API gateway follow these steps:
- Go to the terminal (select "Terminal -> New Terminal" from the file menu if no terminal is open)
- Navigate to the
ApiGateway
folder - Run the command
npm install
Running the API Gateway
To use the API gateway you need to follow these steps:
- Go to the terminal (select "Terminal -> New Terminal" from the file menu if no terminal is open)
- Navigate to the
ApiGateway
folder - Run the command
npm run start
It is recommended to run the API gateway in a separate terminal as you will likely need this to be running in the background while you do your work in another terminal.
Server-Side Logging
The API gateway tool logs all output to the following file:
/ApiGateway/logs/app.log
This file must be excluded from commits which will be merged with the development
branch.