Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
Why am I getting these errors in my console on this nodejs weather app?

This is the link to the github repo for my code.

https://github.com/Messan93/Messan93-WeatherJournal.io

Console error screenshot

Everything seem to be fine but these are the errors am still getting. I can see what the error message is but I don't see anything wrong with the code on that line.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You're using relative URLs on those API calls you're making, and since you're opening your index.html directly from your file system rather than serving it through a server, the paths are relative to your file system.

The simplest fix (just to get your example working) would be to provide absolute URLs instead:

Change postData('/add' to postData('http://localhost:3000/add' and await fetch('/all') to await fetch('http://localhost:3000/all')

A more real-world fix would be to serve the index.html file from your express server.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda