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

127
Visualizações
How to separate the frontend routing from backend endpoints?

I have an express server which handle some routes

/users/login
/users/register 
/orders/add

and so on..

serving a static files, in the default route "/"

so, if user navigated to domain.com for example

it will navigate to that static files

these static files are a react frontend app

the default url "/" will navigate to a login page

and "/dashboard" will navigate to another page

what actually happen, is there's kind of conflict between the backend and frontend routes

for example

if user navigated to "/dashboard"

the expected result is to navigate him to the frontend page

what actual happen is "the backend handle that route not the frontend" and simply return : "I don't have that route (404)

What was in my mind is to navigate any not handled route to the frontend

using that code

  app.get('*', async function (request, reply) {
    return reply.sendFile('index.html')
  })

however, not solved my problem

almost 4 years ago · Santiago Trujillo
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