Skip to content

Instantly share code, notes, and snippets.

@sor4chi
Created December 14, 2023 04:31
Show Gist options
  • Select an option

  • Save sor4chi/a488b66c25017b228b6f45875157a073 to your computer and use it in GitHub Desktop.

Select an option

Save sor4chi/a488b66c25017b228b6f45875157a073 to your computer and use it in GitHub Desktop.
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