{"size": 342, "ext": "js", "max_stars_repo_path": "app/middleware/hasAuth.js", "max_stars_repo_name": "Romserg/express", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/middleware/hasAuth.js", "max_issues_repo_name": "Romserg/express", "max_issues_repo_issues_event_min_datetime": "2021-09-01T19:51:52.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T19:51:52.000Z", "max_forks_repo_path": "app/middleware/hasAuth.js", "max_forks_repo_name": "Romserg/express", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 22.8, "max_line_length": 50, "alphanum_fraction": 0.6403508772}
let createError = require('http-errors');

exports.isLoggedIn = function (req, res, next) {
  if(req.user)
    next();
  else
    next(createError(404, "Page does not exist."))
};

exports.hasAuth = function (req, res, next) {
  if(req.user && req.user.is_admin ==true)
    next();
  else
    next(createError(404, "Page does not exist."))
};