React and Express Routing and Views

Viewed 38

I'm a newbie in web development. I built a project before using Node, Express, and EJS (as my frontend) and now, I am trying to make another one using React as my frontend. I watched and studied a lot of React + Express tutorial videos in Youtube but I think every video only shows a one-page site. My question is how do I handle the routing of Express+React? Where should I put the routes and render multiple pages or views? Should I put it in the app.js under the Node folder? Or should I create another folder under the React app consisting of the js files for different views?

Thank you. I would gladly to answer questions if my post lacks information.

1 Answers

There's an interesting hand to it.

              App
             __|__
            |     |
       Frontend  Backend -->Database(MongoDB)

I think this scanty tree should do justice to it.

I'd suggest you use MERN MongoDB ExpressJs ReactJs Nodejs

Your apps need to be on different servers. This method is effective and secure. Since you already know React, Express, Nodejs... You can check out this link (by cleverprogrammer)to see some MERN projects and how each part of the app communicates with one another seamlessly.

https://youtu.be/ktjafK4SgWM

Related