UNPKG

@sjtix/common

Version:

Common code shared between services

15 lines (14 loc) 450 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.requireAuth = void 0; var not_authorized_1 = require("../errors/not-authorized"); // Assuming current user middleware // will be called before using this // middleware var requireAuth = function (req, res, next) { if (!req.currentUser) { throw new not_authorized_1.NotAuthorized(); } next(); }; exports.requireAuth = requireAuth;