Node.js Middleware Hooks

JSON →
library 1.0.1 ·javascript maintenance
verified May 27, 2026

`mhook` is a small Node.js library that provides middleware-like hook functionality, particularly useful for structuring relations within entities in applications like ODMs or ORMs. It allows developers to define a set of named "actions" and then bind multiple hook functions to these actions. When an action is "triggered," all associated hooks are executed sequentially. Hooks can be asynchronous, supporting both traditional Node.js error-first callbacks and Promises for indicating completion or failure. The current stable version is 1.0.1. Its key differentiators include a simple API for sequential hook execution and built-in support for both callback and promise-based asynchronous operations, making it flexible for various async patterns. It focuses purely on the hooking mechanism without dictating how the hooked objects should behave beyond providing `on` and `trigger` methods.

total hits 33
actors 8 distinct systems
last hit 1d ago human
Amazonbot
4
MetaBot
4
GPTBot
2
Script
1
ClaudeBot
1
Search engines
2
Humans
3

top countries 🇨🇦 Canada · 🇺🇸 United States · 🇫🇷 France · 🇸🇬 Singapore · 🇪🇸 Spain