Created
December 14, 2023 04:31
-
-
Save sor4chi/a488b66c25017b228b6f45875157a073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Hono } from "hono"; | |
| import { validator } from "hono/validator"; | |
| import { createFactory } from "hono/factory"; | |
| import { testClient } from "hono/testing"; | |
| const app = new Hono(); | |
| const factory = createFactory(); | |
| const handler = factory.createHandlers( | |
| validator("json", (c) => { | |
| return { message: "ok" }; | |
| }) | |
| ); | |
| export const app1 = app.post("/", ...handler); | |
| export const app2 = app.post( | |
| "/", | |
| validator("json", (c) => { | |
| return { message: "ok" }; | |
| }) | |
| ); | |
| const client1 = testClient(app1); | |
| const client2 = testClient(app2); | |
| client1.index.$post({ | |
| json: { | |
| message: "ok", | |
| }, | |
| }); | |
| client2.index.$post({ | |
| json: { | |
| message: "ok", | |
| }, | |
| }); | |
| export default app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment