@@ -53,8 +53,15 @@ export class Chain implements Chainable, Responsive {
5353 this . #handlers = init ?? [ ] ;
5454 }
5555
56- /** Register chainable HTTP handlers.
56+ /** Register chainable HTTP handlers.
5757 * @param handlers HTTP chainable handlers.
58+ *
59+ * @example
60+ * ```ts
61+ * import { Chain } from "https://deno.land/x/chain_handler@$VERSION/mod.ts";
62+ *
63+ * const chain = new Chain().next((request, next) => next(), () => new Response("hello"))
64+ * ```
5865 */
5966 readonly next = ( ...handlers : readonly ChainableHandler [ ] ) : this => {
6067 this . #handlers = this . #handlers. concat ( handlers ) ;
@@ -63,6 +70,7 @@ export class Chain implements Chainable, Responsive {
6370 } ;
6471
6572 /** All registered handlers.
73+ *
6674 * @example
6775 * ```ts
6876 * import { Chain } from "https://deno.land/x/chain_handler@$VERSION/mod.ts";
@@ -78,6 +86,16 @@ export class Chain implements Chainable, Responsive {
7886 /**
7987 * @param request `Request` object. The `Request` is cloned and not mutate.
8088 * @param defaultResponse The default `Response` object. Change the response when the {@link handlers} is empty.
89+ *
90+ * @example
91+ * ```ts
92+ * import { Chain } from "https://deno.land/x/chain_handler@$VERSION/mod.ts";
93+ * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
94+ *
95+ * const chain = new Chain()
96+ * const response = await chain.respond(new Request("http://localhost"))
97+ * assertEquals(response.status, 404)
98+ * ```
8199 */
82100 readonly respond = (
83101 request : Request ,
0 commit comments