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

763
Vistas
fetch from javascript and node-fetch from node.js, what are the differences

I am recently learning how to code on udemy, and I encountered a problem. when we fetch api we can fetch from the browser and we can also use node-fetch from node.js. I want to know what's the difference between them. Can we directly fetch api from external server not through the web server.if so what should we fetch data from node.js?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Node.js does not come with the fetch libriary per default. Fetch API does only exist in webbrowsers under window.fetch. Node-fetch is just a lightweight libriary containing this webbrowser fetch.

That said to install and use fetch in Node.js use following commands:

npm i node-fetch

Then to import it use

import fetch from 'node-fetch';

See the official npm package of node-fetch.

The Fetch API is very basic. If you have to use Http Requests in a Node.js app I would recommend using axios.

about 4 years ago · Juan Pablo Isaza Denunciar

0

We can try to fetch the external API from the browser. That can give Cross Origin Resource Sharing (CORS) errors if the endpoint does not want you to access their API from a browser

Then you can write a proxy that accesses the external API from the server, that will be allowed regardless of CORS settings

So accessing an API from NODE will always work (assuming no need for authentication) and fetch from browser may or may not work directly.

NOTE: node-fetch is not native to node

about 4 years ago · Juan Pablo Isaza Denunciar
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