mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
37 lines
575 B
JavaScript
37 lines
575 B
JavaScript
|
/**
|
||
|
* notFound.js
|
||
|
*
|
||
|
* A custom response.
|
||
|
*
|
||
|
* Example usage:
|
||
|
* ```
|
||
|
* return res.notFound();
|
||
|
* // -or-
|
||
|
* return res.notFound(optionalData);
|
||
|
* ```
|
||
|
*
|
||
|
* Or with actions2:
|
||
|
* ```
|
||
|
* exits: {
|
||
|
* somethingHappened: {
|
||
|
* responseType: 'notFound'
|
||
|
* }
|
||
|
* }
|
||
|
* ```
|
||
|
*
|
||
|
* ```
|
||
|
* throw 'somethingHappened';
|
||
|
* // -or-
|
||
|
* throw { somethingHappened: optionalData }
|
||
|
* ```
|
||
|
*/
|
||
|
|
||
|
module.exports = function notFound(message) {
|
||
|
const { res } = this;
|
||
|
|
||
|
return res.status(404).json({
|
||
|
code: 'E_NOT_FOUND',
|
||
|
message
|
||
|
});
|
||
|
};
|