var express = require('express'); var router = express.Router(); const passport = require('passport'); const app = require('../app'); const accounts = require('./../database/accounts/accounts'); function adminLoggedIn(req, res, next) { if (req.user && req.user[2]) { next(); } else { req.flash('error', 'An admin account is required to access this page.'); res.redirect('/auth/login'); } } router.get('/', adminLoggedIn, (req, res, next) => { res.render }); module.exports = router;