Skip to content

Glossary: Building APIs with Node.js

app.addHook

Also written: addHook, onClose hook

A Fastify call that registers a function to run at a fixed point. kc-api uses the `onClose` hook to close the database when the app closes.

Where the book teaches it

Related terms

Hook, preHandlerapp.close()