Dynamic Request between development environment and Production

0

I would like to know how to resolve the request problem between a local and production environment.

Example:

I have a JS function that takes the context of the application and concatenates it with the request.

var ctx = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2));

ctx+'/Portal/listaProdutos'

Locally, you would find: localhost: 8080 / "application_name" / Portal / listProducts

But in production, the requests are taking the duplicate context: www.nomedosite.com/Portal/Portal/listProducts.

How do I solve this problem?

Another tip:

I also have request like this: ctx+'/carregaBarSearch' , being that I'm browsing pages with context /Portal , www.nomedosite.com/Portal/Home

    
asked by anonymous 17.05.2016 / 16:04

1 answer

1

You should define a static dns or ip for your servers and set it as the base path of your requests.

    
17.05.2016 / 16:41