To summarize a very basic MERN app

To summarize how to connect a frontend React app to a backend Express app: 1) Create a server that listens on a port 2) Create routes that receive specific routes ("/notes", "/create") 3) On receiving requests from those routes, do something (create POSTs a new Note to db, which was defined in models and saves, notes GETS from db based on the Note model) * This means => You gotta make a model for a Note 4) On the frontend, your create page needs to axios.post to lh:port/create 5) Your Notes page needs to fetch(asyncs!) from lh:port/notes and set a state variable to its value 6) Have your page map out the state variable Now you have a running, working, cool as hell fullstack MERN app!

#MERN#basic-tutorial

Posted: 02/11/2023

© Corrie Stroup, 2023 | corrie.stroup@gmail.com