mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
35 lines
711 B
JavaScript
35 lines
711 B
JavaScript
// An example file to show how a controller should be structured
|
|
let api = {};
|
|
|
|
/**
|
|
* @api {get} /example/:id Request Example information
|
|
* @apiName GetExample
|
|
* @apiGroup Example
|
|
*
|
|
* @apiParam {Number} id Examples unique ID.
|
|
*
|
|
* @apiSuccess {String} firstname Firstname of the Example.
|
|
* @apiSuccess {String} lastname Lastname of the Example.
|
|
*
|
|
* @apiSuccessExample Success-Response:
|
|
* HTTP/1.1 200 OK
|
|
* {
|
|
* "firstname": "John",
|
|
* "lastname": "Doe"
|
|
* }
|
|
*
|
|
* @apiUse NotFound
|
|
*/
|
|
api.exampleRoute = {
|
|
method: 'GET',
|
|
url: '/example/:param',
|
|
middlewares: [],
|
|
handler (req, res) {
|
|
res.status(200).send({
|
|
status: 'ok',
|
|
});
|
|
},
|
|
};
|
|
|
|
export default api;
|