Pregunta

I would like to reuse some JavaScript resources across my API proxy bundles. But of course I would like to think about what the best practices for accomplishing this first.

For example given the policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Javascript async="false" continueOnError="false" enabled="true" timeLimit="200" name="script-trafficmanagementvars">
    <DisplayName>Script-TrafficManagementVars</DisplayName>
    <FaultRules/>
    <Properties/>
    <IncludeURL>jsc://Script-FunctionLibrary.js</IncludeURL>
    <IncludeURL>jsc://Script-ErrorHandling.js</IncludeURL>
    <ResourceURL>jsc://Script-TrafficManagementVars.js</ResourceURL>
</Javascript>

The following scripts are used across multiple proxies.

Script-FunctionLibrary.js
Script-ErrorHandling.js

While this one is specific to be a Proxy:

Script-TrafficManagementVars.js

I'd like your comment on the best practice for doing this.

I'm concerned about this approach because it builds dependencies across proxies. However I'm noticing opportunities for shared artifacts across proxies.

Quick note:

I deploy my proxies using a maven build pack (4G-gateway-maven-build-pack).

Thanks

¿Fue útil?

Solución

You can check out Resources, which allows you to share resources across environments or organizations. Doing this will give you the added benefit of shorter deploy times.

Otros consejos

All JavaScript files available across an Org are stored under:

/organizations/{org_name}/resourcefiles/jsc

JavaScript files stored in the /organizations collection are available to all the API proxies running in any environment.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top