trifid-core
Version:
Trifid Core
28 lines (27 loc) • 723 B
JavaScript
const factory = async (trifid) => {
const { message } = trifid.config;
let messageToThrow = 'Oops, something went wrong :-(';
if (message) {
messageToThrow = String(message);
}
return {
defaultConfiguration: async () => {
return {
methods: ['GET'],
};
},
routeHandler: async () => {
/**
* Route handler.
*
* @param _request Request.
* @param _reply Reply.
*/
const handler = async (_request, _reply) => {
throw new Error(messageToThrow);
};
return handler;
},
};
};
export default factory;