26 lines
680 B
YAML
26 lines
680 B
YAML
apiVersion: backstage.io/v1alpha1
|
|
kind: API
|
|
metadata:
|
|
name: hello-world-trpc
|
|
description: Hello World example for tRPC
|
|
spec:
|
|
type: trpc
|
|
lifecycle: experimental
|
|
owner: team-c
|
|
definition: |
|
|
import { z } from 'zod';
|
|
import { publicProcedure, router } from '../trpc';
|
|
|
|
export const apiRouter = router({
|
|
version: publicProcedure.query(() => {
|
|
return { version: '0.42.0' };
|
|
}),
|
|
hello: publicProcedure
|
|
.input(z.object({ username: z.string().nullish() }).nullish())
|
|
.query(({ input, ctx }) => {
|
|
return {
|
|
text: `hello ${input?.username ?? ctx.user?.name ?? 'world'}`,
|
|
};
|
|
}),
|
|
});
|