title: How to pass data from AngularJS frontend to Nodejs backend?
body: <p>I have some angular js code here.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
    &lt;head&gt;
      &lt;script src="Scripts/angular.min.js"&gt;&lt;/script&gt;
          &lt;body&gt;    
        &lt;div ng-app=""&gt;
          &lt;form&gt;
            Author:
            &lt;input type="text" ng-model="author"&gt;
            &lt;br&gt;
            &lt;br&gt; Title:
            &lt;input type="text" ng-model="title"&gt;
            &lt;br&gt;
            &lt;br&gt; Body:
            &lt;input type="author" ng-model="body"&gt;
            &lt;br&gt;
            &lt;br&gt;
            &lt;input type="submit" value="Submit"&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      &lt;/head&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and node js with MySQL code here. I am able to pass data to MySQL DB from this node code. How to go ahead with angular to node js? I am coming from a PHP background. I should be able to send data from angular js form to MySQL database. I am able to send data to MySQL database from node code here.</p>
  
  <pre><code>var mysql = require('mysql');
  
  var connection = mysql.createConnection({
    host: 'localhost',
    user: '',
    password: '',
    database: 'copedb'
  });
  connection.connect();
  var cope = {
    author: 'XYZXYZ',
    title: 'Testing Node',
    body: 'Node JS'
  };
  var query = connection.query('insert into cope set ?', cope, function(err, result) {
    if (err) {
      console.error(err);
      return;
    }
    console.error(result);
  });
  </code></pre>