<commit_before>var express = require('express'),
    mongoose = require('mongoose'),
    Application = mongoose.model('Application'),
    auth = require('../../lib/admin-auth'),
    router = express.Router(),
    validate = require("validate.js");

module.exports = function (app) {
    app.use('/admin-ui',auth, router);
};


/**
 * Home page
 *
 * @param  {object} req  http request object
 * @param  {object} res  http response object
 * @param  {callback} next http callback for the next middleware or route
 */
router.get('/', function (req, res, next) {
    res.render('admin-ui/index', {
      title: 'SMS Gateway',
    });
});

/**
 * Applications view page
 *
 * @param  {object} req  http request object
 * @param  {object} res  http response object
 * @param  {callback} next http callback for the next middleware or route
 */
router.get('/applications', function (req, res, next) {
    Application.find(function(err,applications){
        if (err) return errorHandler(500,err,res);
        res.render('admin-ui/applications',{
        title: 'SMS Gateway',
        applicationsList : applications,
        menu: 'application'
        });
      });

});<commit_msg>application list should be sorted with name<commit_after>var express = require('express'),
    mongoose = require('mongoose'),
    Application = mongoose.model('Application'),
    auth = require('../../lib/admin-auth'),
    router = express.Router(),
    validate = require("validate.js");

module.exports = function (app) {
    app.use('/admin-ui',auth, router);
};


/**
 * Home page
 *
 * @param  {object} req  http request object
 * @param  {object} res  http response object
 * @param  {callback} next http callback for the next middleware or route
 */
router.get('/', function (req, res, next) {
    res.render('admin-ui/index', {
      title: 'SMS Gateway',
    });
});

/**
 * Applications view page
 *
 * @param  {object} req  http request object
 * @param  {object} res  http response object
 * @param  {callback} next http callback for the next middleware or route
 */
router.get('/applications', function (req, res, next) {
    Application.find({}).sort({name: 1}).exec(function(err,applications){
        if (err) return errorHandler(500,err,res);
        res.render('admin-ui/applications',{
        title: 'SMS Gateway',
        applicationsList : applications,
        menu: 'application'
        });
      });

});
{'fraction_non_alphanumeric': 0.15579559617781472, 'fraction_numerical': 0.0029081844619858743, 'mean_word_length': 3.2245614035087717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6503200', 'n_tokens_mistral': 707, 'n_tokens_neox': 701, 'n_words': 199}