{"size": 750, "ext": "js", "max_stars_repo_path": "api/controllers/applyLoan.js", "max_stars_repo_name": "mamtabhardwaj12/MFL", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api/controllers/applyLoan.js", "max_issues_repo_name": "mamtabhardwaj12/MFL", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "api/controllers/applyLoan.js", "max_forks_repo_name": "mamtabhardwaj12/MFL", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.7777777778, "max_line_length": 109, "alphanum_fraction": 0.712}
'use strict';
/*
 'use strict' is not required but helpful for turning syntactical errors into true errors in the program flow
 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
*/
var util = require('util');


module.exports = {
    applyLoan: applyLoan
};

var loanService = require('../services/applyLoanService');

function applyLoan(req, res) {
  // variables defined in the Swagger document can be referenced using req.swagger.params.{parameter_name}
  loanService.applyLoan(req.body).then(function (response) {
    res.json(response);
  })
    .catch(function (response) {

      var statusCode = response.statusCode;
      var msg = response.message;
      res.status(statusCode).send({ message: msg });
    });
}
