Skip to content

Instantly share code, notes, and snippets.

@PavelPolyakov
Created January 19, 2019 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PavelPolyakov/9c35760a115667d55e5d326d8ef5d0b5 to your computer and use it in GitHub Desktop.
Save PavelPolyakov/9c35760a115667d55e5d326d8ef5d0b5 to your computer and use it in GitHub Desktop.
import * as fp from "fastify-plugin";
export default fp(async (server, opts, next) => {
server.route({
url: "/error-thrower",
method: ["GET"],
handler: async (request, reply) => {
throw new Error("Oh no, something bad happened, try to debug me");
return reply.send({ date: new Date(), works: true });
}
});
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment