Skip to content

ng-swagger-gen - Modify baseService template #3

@Wayne-Mather

Description

@Wayne-Mather

To allow the API to be configured when it's hosted on any server the production code is on, we need to change the configuration at runtime.

Change the configuration class from protected to public and then in AppComponent we can load the url via the window variable

let myApiEndpointUrl = window["myApiEndpointUrl"];
if(myApiEndpointUrl != null) {
    this.api.config.rootUrl = myApiEndpointUrl;
}

This means the API will always make calls back to the same server it is running on. It also allows you to deploy to any server (UAT, Testing, Production) and have all calls go to the same server the instance is running on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions