Files
WRNexusJS/examples/basic-app/app/api/directory.ts
T
ClintchizandClaude Opus 5 e5de7b54a5 feat(examples): worked example for typed api blocks
- Add examples/basic-app/app/api/directory.ts and app/pages/api-block-demo.wrn
  as the end-to-end worked example for typed api blocks (Task 6).
- Add **/*.generated.api-checks.ts to .prettierignore: this generated file
  must match the CLI's raw output byte-for-byte for check:generated-types,
  and prettier was reformatting it.
- Fix packages/csr/test/api-call.test.ts: no-unsafe-function-type lint error
  from the raw Function type, uncovered while running the full gate.
- Rebuild editors/vscode bundles (packages/compiler and packages/syntax
  changed in Tasks 1-5).
- Regenerate docs/public-api-0.8.json (additive: isIdentPart, isIdentStart,
  skipLiteralOrComment newly exported from packages/syntax).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 17:08:49 +05:30

15 lines
517 B
TypeScript

import { defineEndpoint } from "@wrnexus/core";
import type { Context } from "@wrnexus/core";
const ALL = [
{ name: "Ajay", designation: "UI" },
{ name: "Asha", designation: "Backend" },
{ name: "Chen", designation: "UI" },
];
export const POST = async (ctx: Context) => {
const body = (await ctx.req.json().catch(() => ({}))) as { name?: string };
const needle = String(body.name ?? "").toLowerCase();
return Response.json({ users: ALL.filter((user) => user.name.toLowerCase().includes(needle)) });
};