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

253
Views
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 answers
Answer question

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 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!