Environments

Typically, apps require environment-specific configuration. In this specific app, we have the base address of the RESTful API that should change across environments.

Angular provides a basic solution for configuration through its environments feature. Let's use environment configuration with the RESTful API base address, as follows:

  1. Add the base address in the default environment configuration with the following steps:
    1. Open the environment.ts file in the src/environments folder.
    2. Add the base address configuration as follows:
export const environment = {  production: false,  marketApiBaseUri: 'http://localhost:55564/api/',};
  1. Add the base address in the production environment configuration:
    1. Open the environment.prod.ts file. ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.