title: Different Get methods in Node-Express Rest API
body: <p>I have been creating a website with Mean stack and I stuck at some point. I have a mongo db database and I am currently getting each file from database (to show them on Main page) with my Rest Api which is build with Express.</p>
  
  <p><strong>Server.js</strong></p>
  
  <pre><code>var express = require('express');
  var app = express();
  var mongojs = require('mongojs');
  var db = mongojs('mongodb://username...', ['myApp']);
  var bodyParser = require('body-parser');
  
  app.use(express.static(__dirname + '/public'));
  app.use(bodyParser.json());
  
  app.get('/myApp', function (req, res) {
      db.myApp.find(function (err, docs) {
          console.log(docs);
          res.json(docs);
      });
  });
  
  app.get('/myApp/:id', function (req, res) {
      var id = req.params.id;
      console.log(id);
      db.myApp.findOne({_id: mongojs.ObjectId(id)}, function (err, doc) {
          res.json(doc);
      })
  });
  
  app.listen(3001);
  console.log('Server running on port 3001');
  </code></pre>
  
  <p>There is 2 get method and I can understand that because they have different parameters. So when I call them from controllers, there is no problem because if I provide id, it will call the second get method. But for example I want to use something like this in my website;</p>
  
  <pre><code>app.get('/myApp', function (req, res) {
      db.myApp.find({}).limit(2).skip(0, function(err, docs) {
          console.log(docs);
          res.json(docs);
      });
  });
  </code></pre>
  
  <p>This get method have no parameter like the first get method in server.js but they do different jobs. This is limiting my search with 2 file. How can I use different get methods like this in my Mean Stack application?</p>
  
  <p>This is my code for calling get method from my main controller. How can I make sure to call specific get method? Thanks..</p>
  
  <pre><code>$http.get('/myApp').success(function(response) { .. });
  </code></pre>