<commit_before>const router = require('express').Router();

//import library functions
const lib = require('../lib/user.js');
const auth = require('../lib/auth.js');
const User = require('../models/user.js');

/**
 */
router.route('/')
    .post((req, res) => {
        //TODO: validate data
        const username = req.body.username;
        const password = req.body.password;

        lib.auth_user({username, password}, (err, data) => {
            if (err) {
                res.status(err.status).send(err);
            } else {
                res.send(data);
            }
        });
    });

module.exports = router;<commit_msg>Add documentation for 'auth' route<commit_after>const router = require('express').Router();

//import library functions
const lib = require('../lib/user.js');
const auth = require('../lib/auth.js');
const User = require('../models/user.js');
/**
 * @apiName AIIMS IMS
 * @apiGroup Login
 * @apiVersion 0.0.1
 */

/**
 */
router.route('/').
    /**
     * @apiGroup Login
     * @apiVersion 0.0.1
     *
     * @api {post} /auth 1.1 Request login token
     * @apiDescription Sending a post to this route will return a login
     * token which should be sent with every request to access data.
     * There is no need for logout since the token expires after a fixed
     * time anyway
     *
     * @apiSuccess token An access token
     *
     * @apiSuccessExample {json} Success:
     * {
     *      "token": "an access token"
     * }
     *
     * @apiError 400 Empty/invalid request
     * @apiError 401 Wrong credentials
     * @apiError 404 User does not exist
     *
     * @apiErrorExample {json} Error:
     *  {
     *      "status": "Error status code",
     *      "message": "Error Message"
     *  }
     */
    post((req, res) => {
        //TODO: validate data
        const username = req.body.username;
        const password = req.body.password;

        lib.auth_user({username, password}, (err, data) => {
            if (err) {
                res.status(err.status).send(err);
            } else {
                res.send(data);
            }
        });
    });

module.exports = router;
{'fraction_non_alphanumeric': 0.14909428704133768, 'fraction_numerical': 0.007895959126799815, 'mean_word_length': 1.979253112033195, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 7, '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': '5954009', 'n_tokens_mistral': 652, 'n_tokens_neox': 629, 'n_words': 170}