🎓 A1Learner
🔍
0 of 50 lessons completed

The Four Parts of MERN

The four parts of MERN are MongoDB, Express, React, and Node.js. Each part has one job in the app.

The data part

MongoDB stores the notes for the app.

console.log('MongoDB stores data.');

The server part

Express answers requests from the browser.

console.log('Express answers requests.');

The page part

React builds the pages the reader sees.

console.log('React builds pages.');

Example

const parts = [
  ['MongoDB', 'stores data'],
  ['Express', 'answers requests'],
  ['React', 'builds pages'],
  ['Node.js', 'runs the server']
];

for (const part of parts) {
  console.log(part[0] + ' ' + part[1] + '.');
}

Key points

  • MongoDB is the database, and it stores the notes.
  • Express is the server framework, and it answers requests.
  • React is the library that builds the pages.
  • Node.js is the runtime that runs the server code.

In this example, parts is an array of four small arrays. Each small array holds a part name and its job. The loop prints one line for each part. The output pairs every part with its job.

Note

The four parts work together as one app, not four separate apps.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which part of MERN stores the data?