/
githubmirror
/
trpc
Обзор
Документация
Войти
/
githubmirror
/
trpc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/express-minimal/src/client.ts
24 строки
582 B
Julius Marminge
refactor: rename and deprecate proxy named stuff (#4932)
20 окт 2023, 21:37
Не верифицирован
20 окт 2023, 21:37
7387cde
Код
Авторство
О чём код?
import { createTRPCClient, httpBatchLink } from '@trpc/client'; import type { AppRouter } from './router'; async function main() { const client = createTRPCClient<AppRouter>({ links: [ httpBatchLink({ url: 'http://localhost:3000/trpc', }), ], }); try { const withoutInputQuery = await client.hello.greeting.query(); console.log(withoutInputQuery); const withInputQuery = await client.hello.greeting.query({ name: 'Alex' }); console.log(withInputQuery); } catch (error) { console.error('Error:', error); } } void main();