Home > Blockchain >  How can I create a MERN Stack application?
How can I create a MERN Stack application?

Time:01-27

Ok, so my question is actually a bit more complex.

I know how to develop Node.js apps using Express.js. I also know how to build React apps. The problem is putting it together. I've seen many tutorials do it, but they just use the Express backend as if it was an API.

I don't know if this is the best option, but I'd like to have my Node app, and then in the frontend add React. The main difference is that when it comes to handling the URLs, it will be Node who would do it. Therefore, if Node is on port 3000, you would have to go to localhost:3000 to access the website, opposite the guides I've found online.

I would really appreciate some help, as well as other resources as documentation or videos online.

CodePudding user response:

You can serve the react build folder from your node server. Check this link

CodePudding user response:

NextJS seems to be a good approach for your situation.

It binds a Nodejs backend with a react frontend with an intuitive developer experience.

It has middleware, handles server-side rendering, code splitting, and routing for you. It also provides a development server that allows you to run your application on a specific port (e.g. 3000) and handle the routing on the server side.

  • Related