How to properly add the base url both in and environment.ts (Angular)?


This question is related to a full stack spring boot + angular application.

Spring boot:

I have the following URL in my getMapping method:


Angular service:

I have the following method to consume the spring boot services:

    return this.http.get<RatesList[]>(`${URL_PATH}/conversion`);

In my environment.ts file I have:

export const environment = {
  production: false,
  baseUrl: 'http://localhost:8000'

In my file I have:

export const environment = {
  production: true,
  baseUrl: ''

This is causing some issues because in production environment "" is not recognized throwing a 404 http error.

Based on the data provided, what would be the correct base url in for it to work in production environment?

Source: Angular Questions

Categorized as angular, spring-boot, vps Tagged , ,


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us