Template
1
0

feat: error when action handler is missing

This commit is contained in:
2025-04-18 22:44:46 +00:00
parent d7398f6bff
commit ecb5f80584
6 changed files with 22 additions and 2 deletions

View File

@@ -19,4 +19,5 @@ export const relay = new Relay({ url: "http://localhost:36573", adapter }, [
.params({ userId: z.string().check(z.uuid()) })
.body(UserSchema.omit({ id: true, createdAt: true })),
route.delete("/users/:userId").params({ userId: z.string().check(z.uuid()) }),
route.get("/add-two").search({ a: z.coerce.number(), b: z.coerce.number() }).response(z.number()),
]);

View File

@@ -1,5 +1,6 @@
import { Api } from "../../libraries/api.ts";
import { NotFoundError } from "../../mod.ts";
import { addTwoNumbers } from "./actions.ts";
import { relay } from "./relay.ts";
import { User } from "./user.ts";
@@ -30,4 +31,8 @@ export const api = new Api([
relay.route("DELETE", "/users/:userId").handle(async ({ userId }) => {
users = users.filter((user) => user.id !== userId);
}),
relay
.route("GET", "/add-two")
.actions([addTwoNumbers])
.handle(async ({ added }) => added),
]);