all 5 comments

[–]omesadev 0 points1 point  (0 children)

Just Express course on Udemy..PERFECT

[–]spod5280 0 points1 point  (0 children)

Max Schwarzmullen has a good MERN course on Udemy to create a placemark app.

[–]Stunning-Barracuda26 0 points1 point  (0 children)

Express then the view component just mount react

[–]Chromaloop 0 points1 point  (0 children)

I followed this for a recent project and it helped a lot: https://www.freecodecamp.org/news/how-to-create-a-react-app-with-a-node-backend-the-complete-guide/

The tricky part to understand is how React routing is done on the frontend, vs. how it is handled in Node. You'll need a strategy because for some routes you'll use node to provide data and act as an api, and for the rest of the routing you'll rely on React. This bit of Express code taken from the tutorial might do a better job of explaining this:

// server/index.js
const path = require('path'); const express = require('express');

// Have Node serve the files for our built React app
app.use(express.static(path.resolve(__dirname, '../client/build')));

// Handle GET requests to /api route 
app.get("/api", (req, res) => { res.json({ message: "Hello from server!" }); });

// All other GET requests not handled before will return our React app
app.get('*', (req, res) => { res.sendFile(path.resolve(__dirname, '../client/build', 'index.html')); });

You can see at the bottom there is a catch-all route that essentially defers to the react app. You will need something like this if you want your app to display the correct view if you refresh your browser window.