Step 2

Create a subfolder model (inside the server folder). Add the file Note.js to this folder, with the following content:

class Note {
  constructor(title, text) {
    this.title = title;
    this.text = text;
  }
}

module.exports = Note;

Stop the server (if it was running). Then install the uuid library:

npm install uuid

Now update the Note.js file:

+ const { v4: uuidv4 } = require("uuid");

  class Note {
    constructor(title, text) {
+     this._id = uuidv4();
      this.title = title;
      this.text = text;
    }
  }

  module.exports = Note;

Save and commit the changes.