What's Changed
- BlinkDB introduces middleware! Hook right into BlinkDB methods with the new
use()
method, which lets you modify parameters & return values of various functions of BlinkDB. See the docs for more details.
use(userTable, async (ctx) => {
// Execute code before calling the implementation
console.log(ctx.action); // Log the method called
console.log(ctx.params); // Log parameters given to the method
// Call the native implementation
const result = await ctx.next(...ctx.params);
// Execute code after the implementation
console.log("Everything worked!");
// Don't forget to return the result ;)
return result;
})