PacktPublishing / Full-Stack-React-Projects-Second-Edition

Full-Stack React Projects - Second Edition, published by Packt
MIT License
452 stars 541 forks source link

Routing in client #136

Closed YoofiBP closed 2 years ago

YoofiBP commented 2 years ago

I have configured the express app to send the template HTML when the root is accessed

app.get('/', (req, res) => { res.status(200).send(template()); }) However, when I try to access routes such as '/users', '/profile' it goes to the backend and I get the error 'cannot GET/users' because this isn't a backend route.

In the first few chapters of the book, while building the social media app this is how it was indicated to go about it. Why isn't the router working with the given information in the book. Currently I cannot render the specific pages by directly entering the URL or reloading. I have to go to the root and click a linked button

YoofiBP commented 2 years ago

Closing this because Ive seen it is explained later in the book. The way the tutorial is laid out it appeared the routing was supposed to work on its own