UNPKG

@flexiblepersistence/backnextapi

Version:

A simple API framework using Flexible Persistence

23 lines 697 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const source_1 = require("../../source"); class SessionController extends source_1.BaseController { constructor() { super(...arguments); this.element = 'sessions'; this.super = 'session'; } async auth(req, res, fn) { if (req.headers.authorization) { req.user = req.headers.authorization; await fn(true); } else { const error = new Error('Unauthorized'); error.name = 'Unauthorized'; await fn(error); } } } exports.default = SessionController; //# sourceMappingURL=sessionController.js.map