Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
How to toggle proxy url in package.json based on the ixp flag? React App

#How to toggle proxy url in package.json based on the ixp flag? React App...#

I would like - the switching of proxy url based on different value of some-variable inside the service class:

I have two proxy servers: - "https://tst.api1.com" and "https://tst.api2.com"

inside React component i have getSex() function that returns either male or female, if male - i would like to invoke api1 else api2;

package.json:

{
"proxy": {
    "/abc": {
        "target": "https://tst.api1.com" // i need this to be toggeled based on getSex() value
    }
  }
}

React Component:

export async function getAllUsers() {
const response = await fetch('/abc/users');
return await response.json();
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda