Jaggery Endpoint Endpoint (WS02) / Dynamic Endpoint

I am currently developing an application in Jaggery that I am deploying in my API manager.

From the back of Jaggery, I invoke the SOAP web service using the method registered here , which indicates:

<% var url = 'http://jaggeryjs.org/apidocs/resources/home.jag'; var xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr.setRequestHeader("user" , "madhuka"); xhr.send(); print("ReadyState : "+xhr.readyState); print("<br>ResponseStatus : "+xhr.status); print("<br>ResponseText : "+xhr.responseText); %> 

Everything works and works fine for me, however, I would like to remove the hard-coded URL and replace it with some kind of environment-based URL search .

What is the right way to do this? Can I specify an endpoint in the API manager and access it? Or maybe use an EPR file. In this sense, I have had little luck with the Jaggery documentation.

+7
web-services wso2 wso2-am api-manager jaggery-js
source share
1 answer

I have seen many jaggery applications developed for WSO2 products. The practice used in them is to have a configuration file in json format. You may have a method for reading and retrieving the necessary values โ€‹โ€‹by passing the attribute name.

You can either have a configuration file for each environment, or package it using an application, or have one configuration file with endpoints for each environment. If you intend to support one configuration file, you need to dynamically build the attribute name and read its value. To do this, you need to maintain the environment in which it is located. Therefore, I recommend using a configuration file for each environment and linking the correct file for the environment.

+1
source share

All Articles