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

256
Visualizações
express cannot GET error using with react

I manage to setup react, basically express just as the api server. I can navigate around my react app using react-router, it's a single page application.

But when I refresh for example http://localhost/login I got error of cannot GET /login I know the issue, but I don't know how to fix it.

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

0

You haven't posted your code, but I guess that you don't return the React app at the * route, which means that if you start at /, you'll be fine because it's handled, but if you want to get any other endpoint not via the app itself, but directly via an address, Express will look for a /login (for example) route handler and hence it's not there, it'll return 404.

TLDR: send the React SPA as the response on * GET and React Router will handle the rest.

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