The OpenHIM routes through the ports
5001 (http) and
7786 tcp. Any request that passes through the OpenHIM is a transaction. For the routing to happen, there has to be a channel that has the route(s) to the upstream server(s). The request has to have a path that matches the channel's
To route using the OpenHIM, create a channel on the OpenHIM console or through the API. If the channel is configured to be a private channel, a client will need to be created. The client and the channel should be configured such that they are linked. This is done by ensuring that one of the
roles created in client matches one of the
roles in channel's
allow property. The client id and password will be used for authentication. The transaction is created irregardless of whether the upstream server (mediator) being routed to exists or not.
Create the channel.
Ensure that request's
<PATH> matches the channel's
urlPattern. If the channel is private the client's Id and password will have to be passed in for the username and password.
Copy the below code into a file titled
router.js and supply the correct implementation details.
Execute the below commands in your terminal to run the nodejs script
Copy the below code and replace the
<CLIENT_PASSWORD> values with correct implementation details. If the channel is public the username and password can be passed in for the
The response body will be returned. If the upstream server (server being routed to) is down the response status will be
500 and the response body will be
An internal server error occurred.