Handler

A handler can be:

  • A function

    const handler = (ctx) => {};
  • A Promise (async (ctx) => ...)

    const handler = async (ctx) => {};
  • A function/Promise returning data

    const handler = () => new TextBody("...");
  • A router (new Router())

    const handler = new Router();
  • A list of handlers ([middleware, (ctx) => ..., router])

    const handler = [
    myMiddleware1,
    myMiddleware2,
    myMiddleware3,
    (ctx) => {},
    myRouter,
    async (ctx) => {},
    ];