Skip to content

Glossary: Building APIs with Node.js

Hook, preHandler

Also written: hook, preHandler

A hook is a function Fastify runs at a fixed point in handling a request. A `preHandler` runs just before the handler and can stop the request by throwing.

Where the book teaches it

Related terms

app.addHook