title: send json object or render a view with express route
body: <p>I have two routes: <code>/news</code> and <code>/news-paginate</code> (I know it is a not good URL but it doesn't matter atm). In the <code>news</code> route, I load 5 records from the database and render a populated view. In the <code>/news-paginate</code> route, I load other 5 records based on the page number and size sent from the client; this route responds with a JSON object. </p>
  
  <p><strong>news route</strong></p>
  
  <pre><code>router.get('/news', function (req, res) {
  
  ...
  
    connection.query(queries['news_list'], [language, +pageSize, +offset], function (err, rows) {
        res.render('news', {news: rows});
    });
  });
  </code></pre>
  
  <p><strong>news-paginate route</strong></p>
  
  <pre><code>router.get('/news-paginate', function (req, res) {
    var language = 'RU';
    var pageSize = req.query.pageSize;
    var pageNumber = req.query.pageNumber;
    var offset = (pageNumber - 1) * pageSize;
  
    connection.query(queries['news_list'], [language, +pageSize, +offset], function (err, rows) {
      res.json(rows);
    });
  });
  </code></pre>
  
  <p>I am concerned about my architecture. Is my approach correct? I have two routes with the same functionality and different responses. Should I somehow combine these two routes into one?</p>