title: How to separate the routes and database functionality from appRouter.js using NodeJS and Express
body: <p>in angularjs at express services I want all the calling services at one place.. something like this structure..<br>
  <br>routes(some folder)<br>|-API (all calls)<br>|-Services<br>|-schemas(mongoose)
    <br>
  if these are my <b>services</b> <br></p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
  var express = require('express');
  var router = express.Router();
  var conveyModel = require('../model/Schema');
  
  console.log("convey api router ready");
  /* GET /convey listing. */
  router.get('/', function(req, res, next) {
    console.log("convey api get '/'");
    conveyModel.find(function (err, convey) {
      if (err) return next(err);
      res.json(convey);
    });
  });
  
  /* POST /convey */
  router.post('/', function(req, res, next) {
    console.log("convey api post '/'");
    console.log("retrieving:: " + req.body);
    conveyModel.create(req.body, function (err, post) {
      console.log("saving:: " + post);
      if (err) return next(err);
      res.json(post);
    });
  });
  module.exports = router
  </code></pre>
  
  <p><br>i want to call all services in other <b>Api</b> js somthing like this,<br></p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>router.post('/api/v1/login', auth.login);
  router.get('/api/v1/me', users.getAll);
  </code></pre>
  
  <p><br></p>
  
  <p>I'm not able to understand how it works... if there is some working example, with what I want it would be great.</p>