add changes from v0.3

This commit is contained in:
JJ Kasper
2018-11-24 00:23:32 -06:00
parent 73f05ce4a3
commit 111cf2ed35
133 changed files with 10768 additions and 7443 deletions

View File

@@ -0,0 +1,17 @@
/**
* returns forbidden status when user not present
* @param {Object} - express.Request
* @param {Object} - express.Response
* @returns {boolean} - whether if had user or not
*/
module.exports = function requireUser(req, res, next) {
if (!req.user) {
res.status(403).json({
status: 'error',
message: 'You do not have permission to access this',
})
return false
}
if (next) next()
return true
}