mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-27 02:10:35 +01:00
1 line
6.9 KiB
JSON
1 line
6.9 KiB
JSON
[{"_path":"/get-started/installation","_dir":"get-started","_draft":false,"_partial":false,"_locale":"en","_empty":false,"title":"Installation","description":"tRPC-Nuxt provides first class integration with tRPC.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"h2","props":{"id":"1-add-to-existing-nuxt-project"},"children":[{"type":"text","value":"1. Add to existing Nuxt project"}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"pnpm add @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n","filename":"pnpm","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"pnpm add @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"npm install @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n","filename":"npm","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"npm install @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"yarn add @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n","filename":"yarn","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"yarn add @trpc/server@next @trpc/client@next trpc-nuxt@beta zod\n"}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"why-trpcserver"},"children":[{"type":"text","value":"Why @trpc/server?"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For implementing tRPC endpoints and routers."}]},{"type":"element","tag":"h4","props":{"id":"why-trpcclient"},"children":[{"type":"text","value":"Why @trpc/client?"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For making typesafe API calls from your client."}]},{"type":"element","tag":"h4","props":{"id":"why-zod"},"children":[{"type":"text","value":"Why zod?"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Most examples use "},{"type":"element","tag":"a","props":{"href":"https://github.com/colinhacks/zod","rel":["nofollow"]},"children":[{"type":"text","value":"Zod"}]},{"type":"text","value":" for input validation and tRPC.io highly recommends it, though it isn't required."}]},{"type":"element","tag":"h2","props":{"id":"2-install-module"},"children":[{"type":"text","value":"2. Install module"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This will transpile "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"trpc-nuxt"}]},{"type":"text","value":" and exclude "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"trpc-nuxt/client"}]},{"type":"text","value":" from optimized dependencies by Vite."}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtConfig({\n modules: ['trpc-nuxt/module']\n})\n","filename":"nuxt.config.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineNuxtConfig({\n modules: ['trpc-nuxt/module']\n})\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"3-enable-strict-mode"},"children":[{"type":"text","value":"3. Enable strict mode"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If you want to use Zod for input validation, make sure you have enabled strict mode:"}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"{\n \"extends\": \"./.nuxt/tsconfig.json\",\n \"compilerOptions\": {\n \"strict\": true\n }\n}\n","filename":"tsconfig.json","language":"json"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"{\n \"extends\": \"./.nuxt/tsconfig.json\",\n \"compilerOptions\": {\n \"strict\": true\n }\n}\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtConfig({\n typescript: {\n strict: true\n }\n})\n","filename":"nuxt.config.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineNuxtConfig({\n typescript: {\n strict: true\n }\n})\n"}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If strict mode is too much, at least enable "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"strictNullChecks"}]},{"type":"text","value":":"}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"{\n \"extends\": \"./.nuxt/tsconfig.json\",\n \"compilerOptions\": {\n \"strictNullChecks\": true\n }\n}\n","filename":"tsconfig.json","language":"json"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"{\n \"extends\": \"./.nuxt/tsconfig.json\",\n \"compilerOptions\": {\n \"strictNullChecks\": true\n }\n}\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtConfig({\n typescript: {\n tsConfig: {\n strictNullChecks: true\n }\n }\n})\n","filename":"nuxt.config.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineNuxtConfig({\n typescript: {\n tsConfig: {\n strictNullChecks: true\n }\n }\n})\n"}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"next-steps"},"children":[{"type":"text","value":"Next Steps"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Now that you've installed the required dependencies, you are ready to start building your application."}]}]},"_type":"markdown","_id":"content:1.get-started:1.installation.md","_source":"content","_file":"1.get-started/1.installation.md","_extension":"md"},{"_path":"/examples/basic","_dir":"examples","_draft":false,"_partial":false,"_locale":"en","_empty":false,"title":"Basic","description":"tRPC-Nuxt provides first class integration with tRPC.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"basic-example"},"children":[{"type":"text","value":"Basic Example"}]}]},"_type":"markdown","_id":"content:2.examples:1.basic.md","_source":"content","_file":"2.examples/1.basic.md","_extension":"md"}] |