1
0
Fork 0
nodejs-backend-template/server/api/admin/controllers/get-profile.js

25 lines
900 B
JavaScript

const Joi = require('joi');
/**
* @module An object to retrieve information about the administrator.
* @type {Object}
* @property {string} method - HTTP method (get).
* @property {string} path - The path to process the request.
* @property {Joi.ObjectSchema} validationSchema - Input validation scheme.
* @property {Array} middlewares - Middlewares that can be applied to the request processing (empty array).
* @property {Function} handler - The function that handles the request.
* @async
* @param {Object} req - The request object.
* @param {Object} res - Response object.
* @returns {Object} - An object that contains information.
* @throws {Error} - An exception if an error occurred while processing the request.
*/
module.exports = {
method: 'get',
path: '/whoami',
validationSchema: Joi.object({}),
middlewares: [],
handler: async function (req, res) {
return req.admin;
}
};