const baseProcedure = t.procedure
.input(i => i as { townName: string })
.use((opts) => {
const input = opts.input;
console.log(`Handling request with user from: ${input.townName}`);
return opts.next();
});
export const appRouter = t.router({
hello: baseProcedure
.input(i => i as { name: string })
.query((opts) => {
const input = opts.input; // <-- object with both properties
return {
greeting: `Hello ${input.name}, my friend from ${input.townName}`,
};
}),
});
const baseProcedure = t.procedure
.input(i => i as { townName: string })
.use((opts) => {
const input = opts.input;
console.log(`Handling request with user from: ${input.townName}`);
return opts.next();
});
export const appRouter = t.router({
hello: baseProcedure
.input(i => i as { name: string })
.query((opts) => {
const input = opts.input; // <-- object with both properties
return {
greeting: `Hello ${input.name}, my friend from ${input.townName}`,
};
}),
});