title: Nodejs sharing same initiated class to sub routes
body: <p>I have a folder structer like this</p>
  
  <pre><code>.
  ├── models
  │   └── System.js
  └── src
      ├── app.js
      ├── index.js
      └── routes
          ├── lemon
          │   ├── auth
          │   │   └── index.js
          │   └── index.js
          └── index.js
  </code></pre>
  
  <p>.</p>
  
  <p><strong>/models/System.js</strong></p>
  
  <pre><code>class System {
      constructor() {
          this.test = null;
      }
  }
  
  module.exports = System
  </code></pre>
  
  <p>.</p>
  
  <p><strong>/src/app.js</strong></p>
  
  <pre><code>const express = require("express");
  const _System = require("../models/System");
  
  const app = express();
  
  var System = new _System();
  System.test = 1;
  
  //..... other codes
  </code></pre>
  
  <p>.</p>
  
  <p><strong>/src/routes/lemon/auth/index.js</strong></p>
  
  <pre><code>const express = require("express");
  const _System = require("../../../../models/System");
  
  const router = express.Router();
  
  console.log(_System.test); //returns null
  
  router.get('/', (req, res) =&gt; {
      res.send("Hello World");
  });
  
  module.exports = router;
  </code></pre>
  
  <p>.</p>
  
  <p>My folder structer is like this and I'm trying to share the <strong>System.test = 1</strong> value defined at <em>/app.js</em> to <em>/routes/lemon/auth/index.js</em>.
  But I couldn't able to do that and it always return null.</p>
  
  <p>Is there anyway to share the same class init to sub routes?</p>
  
  <p><em>PS: I know that my code isn't right and I've searched a lot. I can't understand English resources too much at the moment but I really searched up for it.</em></p>