title: Using a Node.js class in Cloud Functions for Firebase
body: <p>I am a new to Node.js and Firebase.
  I have successfully tried to deploy some Cloud Functions to test them a bit.
  I have a Node.js project in which I have a class defined as:</p>
  
  <pre><code>import * as Api from './api';
  
  export default class MyClass {
      constructor(props) {[...]}
  
      someFunction(props) {
          return Api.someOtherFunction(props.arg1).then([..]).catch([..]);
      }
  }
  </code></pre>
  
  <p>In the Api code I use the firebase admin SDK and I work with the real time database.Ex.:</p>
  
  <pre><code>ref.child(`users/${userId}`).set({
              id: userId,
              arg1: arg1,
              arg2: arg2
          });
  </code></pre>
  
  <p>Now, the problem is that I would like to use <code>MyClass</code> in a cloud function.
  I have read a lot about ES6 in Cloud Functions, too (ex.: <a href="https://codeburst.io/es6-in-cloud-functions-for-firebase-959b35e31cb0" rel="nofollow noreferrer">here</a>), but I am not able to get rid of the error message </p>
  
  <blockquote>
    <p>SyntaxError: Unexpected token import</p>
  </blockquote>
  
  <p>I have tried to convert to require statements but I am not able to require my local module where <code>MyClass</code> is.
  I don't care if it will be a Node.js local module or simply some classes in clear hierarchical structure.</p>
  
  <p>What I would like to ask is if there is a specific documentation about this situation (I have searched a lot for it) and/or if I am following the right way to structure my project.
  If the answer is "NO", please give me some tips on how to structure it.</p>