title: Call Node.js functions in React Native Project
body: <p>I'm making a react native app and I want to get some data on MySQL database. I made a javascript file doing that but I don't know how to link this class with my react component.</p>
  
  <p>I tried to include it as a module in my component:</p>
  
  <pre><code>var api = require('../../api/APIConnection');
  </code></pre>
  
  <p>... but I'm having an error:</p>
  
  <pre><code>"Unable to resolve module crypto from 'User/Documents/X/node_modules/mysql/lib/Connection.js
  </code></pre>
  
  <p>and I can't figure it out.</p>
  
  <p>Here is my javascript module:</p>
  
  <pre><code>module.exports = {
  
  getMySQL()
  {
      if (this.mysql == null)
          return require('mysql');
      else
          return this.mysql;
  },
  
  connect()
  {
      // Connect to database
      con = mysql.createConnection({
          host: "localhost",
          user: "root",
          password: "",
          port: 8889,
          database: "..."
      });
  
      etc...
  },
  </code></pre>
  
  <p>Thank you for help!</p>