title: Insert form data into mysql database table using node.js and sequelize
body: <p>I have a <code>NodeJS</code> app and I want to insert some data from a form into a table  of my <code>MySQL</code>-database by using the <code>sequelize()</code>-method.</p>
  
  <p>So here is my form</p>
  
  <pre><code>&lt;form id="addVideo" method="post"&gt;
      &lt;input type="url" name="video_url" required&gt;&lt;/input&gt;
      &lt;input type="hidden" value="" name="artist_id"&gt;&lt;/input&gt;
      &lt;input type="hidden" value="youtube" name="type"&gt;&lt;/input&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My post function:</p>
  
  <pre><code>$('form#addVideo').submit(function(e){
      e.preventDefault();
  
      var form = $(this);
      var jsonvideoFormData = utils.serializeToJSON(form);
      var xhrData = _.pick(jsonvideoFormData, 'video_url', 'artist_id', 'type');
  
      api.post('/videos', xhrData, function(response){
         alert('Video has been added!');
      });
  });
  </code></pre>
  
  <p>Then the backend code looks like this:</p>
  
  <pre><code>exports.addVideo = function(req, res, next){
  
    var videoURL = req.body.video_url;
    var artistId = req.body.artist_id;
    var type = req.body.type;
  
    db.sequelize.query('INSERT INTO social_urls (artist_id,urls,type) VALUES('artistId','videoURL','type')', function(err) {
      if(err){
          return res.json(400, {response: {code: 400, message:'An error appeared.'}});
      } else{
         console.log('succes');
         res.json(201, {response: {code: 201, message: 'Video has been added'}});
      }   
  
    });
  
  }
  </code></pre>
  
  <p>But for some reason I do not know this is not working. Can anyone help me out?</p>
  
  <p>Many thanks!!                   </p>