Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
API de llamada en producción y desarrollo en reaccionar js

si la URL es localhost/8085

Luego, todas las llamadas API se realizarán a localhost: 9764/API

si la url es http://10.1xx.xx.xx:8085/Amp Entonces todas las api llaman usando 10.1xx.xx.xx:9764/api...

¿Es esto posible en React js?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puede obtener el nombre del host (window.location.host) y hacer cualquier cosa a partir de eso ( https://stackoverflow.com/a/54691801/7174186 )

about 4 years ago · Juan Pablo Isaza Report

0

esto funciona para mi.

 const url="" if(process.env.NODE_EnV==="development"){ url =localhost:8085 }else if(process.env.NODE_EnV==="production"){ url = "http://10.1xx.xx.xx:8085/Amp " }
about 4 years ago · Juan Pablo Isaza Report

0

Suponiendo que su aplicación se creó con create-react-app , puede crear dos archivos .env diferentes: .env.development y .env.production y crear dentro de ellos variables con los mismos nombres. Por lo tanto, si ejecuta su aplicación localmente, la aplicación usará valores de variables de .env.development y en producción de .env.production .

 //.env.development REACT_APP_API_URL=ABC
 //.env.production REACT_APP_API_URL=DEF
 //Component.tsx const URL = process.env.REACT_APP_API_URL
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!