25 lines
890 B
JavaScript
25 lines
890 B
JavaScript
const Joi = require('joi');
|
|
/**
|
|
* @module An object to retrieve information about the user.
|
|
* @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.user;
|
|
}
|
|
};
|