Skip to content

add afterEach hooks for customize handler response #10

Description

@TomokiMiyauci

afterEach provides a hook that is called after each handler call.

It can take the actual handler return value and return a Response object.

That is, you can define a custom response.

This hook is only called if a user-defined handler is called. That is, it will not be called:

import { URLRouter } from "https://deno.land/x/http_router/mod.ts"

URLRouter({
  "/api": () => new Response()
}, {
  afterEach: (res) => res
})(new Request("http://localhost/"))

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions