Configuring JS frontend depending on how the app was deployed

I have a Java+React web application. There are two options of how to deploy it:

  1. You launch backend with Spring Boot and React with Node.js separately.
  2. You build a .ear with bundle.js building with frontend-maven-plugin and then deploy it on an app server.

The thing is that in the first case Spring Boot launches, for example, on localhost:8080 and Node.js on localhost:8081, they need different ports. And in the second case everything is in the same place and with completely different address. For the second case, when I make requests from frontend to backend I can just skip domain name and write a path. But in the first case I have to specify domain name since backend has different domain name.

My question is how to solve this problem and make frontend understand how the app was deployed. I can think of something like passing an argument with node.js command or something, but not sure if that is a correct and neat way of doing that.

I can provide the code if needed.

180 thoughts on “Configuring JS frontend depending on how the app was deployed”

  1. Hello this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or
    if you have to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience.

    Any help would be greatly appreciated!

    Reply
  2. Howdy would you mind sharing which blog platform you’re working with?
    I’m planning to start my own blog soon but I’m having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs
    and I’m looking for something unique.
    P.S Sorry for getting off-topic but I had to ask!

    Reply
  3. You actually make it appear so easy along with your presentation but I find this topic to be actually something which I think I’d by no means understand. It seems too complicated and extremely extensive for me. I’m having a look forward for your next put up, I will try to get the hang of it!

    Reply
  4. It is appropriate time to make a few plans for the longer term and it is time to be happy.
    I’ve read this submit and if I could I want to suggest you few attention-grabbing
    issues or tips. Maybe you could write subsequent articles relating to this article.
    I want to learn more things approximately it! cheap flights http://1704milesapart.tumblr.com/ cheap flights

    Reply
  5. Good post. I learn something totally new and challenging on websites
    I stumbleupon everyday. It will always be useful to read through
    articles from other writers and use a little something from other sites.

    Reply
  6. This is really interesting, You are an excessively professional
    blogger. I’ve joined your feed and sit up for looking for more of your wonderful
    post. Also, I’ve shared your web site in my social networks

    Reply
  7. Hello I am so thrilled I found your blog, I really found you by accident, while I was researching on Yahoo for something else, Anyhow I am here now and would just like
    to say thanks a lot for a tremendous post and a all round interesting blog (I also love the theme/design), I don’t have time
    to look over it all at the moment but I have saved it and also added your RSS
    feeds, so when I have time I will be back to read much more, Please do keep
    up the great job.

    Reply
  8. I have fun with, lead to I discovered exactly what I was having a look for.
    You have ended my 4 day lengthy hunt! God Bless
    you man. Have a nice day. Bye

    Reply
  9. What you wrote was actually very reasonable. However, what about
    this? what if you were to write a awesome title?
    I am not suggesting your content is not good., but suppose you added a post title
    to maybe grab folk’s attention? I mean Configuring JS frontend depending on how the app
    was deployed – JavaScript Help is a little vanilla.
    You should peek at Yahoo’s home page and watch how they create post headlines to grab viewers to click.
    You might add a video or a pic or two to
    get people excited about everything’ve got to say. In my opinion,
    it might make your blog a little bit more interesting.

    Reply
  10. A person necessarily assist to make significantly posts I would state.
    This is the very first time I frequented your website page and to this
    point? I surprised with the analysis you made to create
    this actual submit incredible. Fantastic job!

    my blog post special

    Reply
  11. Howdy! This blog post couldn’t be written much better!
    Reading through this post reminds me of my previous roommate!
    He constantly kept preaching about this. I most certainly will send this post to him.
    Pretty sure he’s going to have a good read. Thank you for sharing!

    Reply