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

148
Views
¿Cómo obtener de mi host local? Conecte React.js a Node.js

Creando mi primera aplicación MERN y conectando el frontend al backend.

Dando pequeños pasos y tratando simplemente de llamar a los "libros" ya existentes en mi base de datos mongo.

esto es lo que tengo

 const fetchingFunction = () => { fetch('http://localhost:5000/books', { method: "GET", headers: { "Content-Type": "application/json", 'Accept': 'application/json' } }).then(function(response) { response.json(); }).then(data => console.log(data)) }

sigo recibiendo el error

 Uncaught (in promise) SyntaxError: Unexpected token h in JSON at position 0
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe devolver la response.json() .

 const fetchingFunction = () => { fetch('http://localhost:5000/books', { method: "GET", headers: { "Content-Type": "application/json", 'Accept': 'application/json' } }).then(function(response) { return response.json(); }).then(data => console.log(data)) }
about 4 years ago · Juan Pablo Isaza Report

0

agregar response.json() resolverá su problema

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!