title: NodeJS: Calling API Routes from other part (web/admin) of code
body: <p>I have 3 domains configured in my nodeJS app. 
  <code>api.example.com</code>, <code>www.example.com</code>, <code>admin.example.com</code> 
  To build this app in SOA way, I have different routes for API front and admin. 
  so for routes
  <code>www.example.com/myAddresses/{customerId}</code> </p>
  
  <pre><code>var httpProxy = require('http-proxy');
  
  var proxy = new httpProxy.RoutingProxy();
  
  app.get('/myAddresses/:customerId, function(request, response) {
  
      // I can use express proxy to call API.
      proxy.proxyRequest(req, res ,{
          host: 'api.example.com',
          port: 80
      });
  
  });
  </code></pre>
  
  <p>The problem with proxy I see that is proxy makes an HTTP request, which is an extra overhead. I'd like to make an internal code call.</p>
  
  <p>A great implementation for same I have seen with <code>Laravel</code> using a package <code>DINGO</code>
  You can make an static function call in laravel like 
  <code>Dingo::API('/myAddresses', $request)</code>
  Can anyone point me right direction to implement this feature?</p>
  
  <h2>EDIT</h2>
  
  <p>So I am already using the given approach by <code>@Krzysztof Sztompka</code>. I'll explain this more. My Express JS app has three subapps <code>api</code>, <code>front</code> &amp; <code>admin</code>. In each module I have three sections for routes and controllers for each app respectively. Now the idea may not be only to call one route of app from same app, e.g. front route --> front route. </p>
  
  <p>I only want to call Route of API app from web/admin apps. calling a function of a model is not a problem but as Krzysztof rightly said it won't be SOA approach. If you guys can just help me how to call route (and if possible call route of different app) from my controller that would be a great help.</p>