Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

GuardTarget

import type { GuardTarget } from "https://raw.githubusercontent.com/mandarineorg/mandarinets/master/mod.ts";

Define the behavior of a user-side guard The guard target will be called at the time of a request. onGuard(requestContext, ...args) will be called before executing the endpoint.

If onGuard returns false, the endpoint's execution will be discarded. In order to keep the execution cycle going, onGuard must return true.

   export class MyGuard implements GuardTarget {
       onGuard(requestContext: Mandarine.Types.RequestContext) {
           console.log("onGuard() called");
           return true;
       }
   }
interface GuardTarget {
onGuard(requestContext: Mandarine.Types.RequestContext, ...args: Array<any>): boolean;
}

§Methods

§
onGuard(requestContext: Mandarine.Types.RequestContext, ...args: Array<any>): boolean
[src]