UNPKG

trifid-core

Version:
28 lines (27 loc) 723 B
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;