title: Learning React > Express > Node.js > Mysql database connection. Stuck with tutorial
body: <p>I'm in the process of learning React, and one of the steps is learning how to connect to a database using an Express server and a Mysql database. I was doing very well until I got stuck with a tutorial. As I've read many places in Stackoverflow, it seems it's a common thing that tutorial about all this assume a certain level by the learner. It's one of those cases.</p>
  <p>Instead of wasting your time with parts of the problem that aren't really important, I'll just ask about the precise part where I'm stuck. The tutorial I'm following is the following:
  <a href="https://www.edureka.co/blog/node-js-mysql-tutorial/" rel="nofollow noreferrer">https://www.edureka.co/blog/node-js-mysql-tutorial/</a></p>
  <p>Everything was going smoothly until I came to the part where it says:
  &quot;Type in the below codes to define all the required routines:</p>
  <p>learnerAddOrEdit&quot;</p>
  <p>First, you have to create the procedure:</p>
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `learnerAddOrEdit`(
  IN _learner_id INT,
  IN _learner_name VARCHAR(45),
  IN _learner_email VARCHAR(45),
  IN _course_Id INT
  )
  BEGIN
  IF _learner_id = 0 THEN
  INSERT INTO learnerdetails(learner_name,learner_email,course_Id)
  VALUES (_learner_name,_learner_email,_course_Id);
  SET _learner_id = last_insert_id();
  ELSE
  UPDATE learnerdetails
  SET
  learner_name = _learner_name,
  learner_email = _learner_email,
  course_Id = _course_Id
  WHERE learner_id = _learner_id;
  END IF;
  SELECT _learner_id AS 'learner_id';
  END
  </code></pre>
  <p>That went well, and it's created. Then, you have to add the code to Script.js:</p>
  <pre><code>//Router to INSERT/POST a learner's detail
  app.post('/learners', (req, res) =&gt; {
  let learner = req.body;
  var sql = &quot;SET @learner_id = ?;SET @learner_name = ?;SET @learner_email = ?;SET @course_Id = ?; 
  CALL learnerAddOrEdit(@learner_id,@learner_name,@learner_email,@course_Id);&quot;;
  mysqlConnection.query(sql, [learner.learner_id, learner.learner_name, learner.learner_email, learner.course_Id], (err, rows, fields) =&gt; {
  if (!err)
  rows.forEach(element =&gt; {
  if(element.constructor == Array)
  res.send('New Learner ID : '+ element[0].learner_id);
  });
  else
  console.log(err);
  })
  });
  </code></pre>
  <p>That also went well. Then it asks you to POST the request in Postman (apologies, they only provide the picture here):</p>
  <p>1]: <a href="https://i.stack.imgur.com/1S4Nb.png" rel="nofollow noreferrer">https://i.stack.imgur.com/1S4Nb.png</a></p>
  <p>That is where I get stuck. I proceed the same way the example image above shows, but I'm missing something. Here's what my request looks like:</p>
  <p><a href="https://i.stack.imgur.com/QMDwx.png" rel="nofollow noreferrer">Picture of my request</a></p>
  <p>What am I missing? I see that the tutorial example somehow inserts &quot;New Learner ID: 5328&quot;, but I have no clue where this is being done.</p>
  <p>I apologize for this question, I'm obviously a noob at this and it's very hard to learn this connection to database part based on the tutorials I'm finding online. Your help is much appreciated :D Please let me know if I'm not explaining the problem well, I'll be glad to provide more information.</p>
  <p>Best, Hugo</p>