{"id":112355,"date":"2026-10-03T09:57:08","date_gmt":"2026-10-03T01:57:08","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/112355.html"},"modified":"2026-10-03T09:57:08","modified_gmt":"2026-10-03T01:57:08","slug":"howtographql%ef%bc%9a%e7%94%a8-prisma-client-%e5%b0%86-typescript-apollo-graphql-%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%8e%a5%e5%85%a5-sqlite-%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/112355.html","title":{"rendered":"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93"},"content":{"rendered":"<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011howtographql<\/h3>\n<p class=\"gcb-project-desc\">The Fullstack Tutorial for GraphQL<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/ho\/howtographql<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u672c\u6587\u57fa\u4e8e HowToGraphQL \u6559\u7a0b\u4ed3\u5e93&#xff08;The Fullstack Tutorial for GraphQL&#xff09;\u4e2d TypeScript &#043; Nexus &#043; Apollo Server \u540e\u7aef\u6559\u7a0b\u7684\u7b2c 5 \u7ae0 content\/backend\/typescript-apollo\/5-connecting-server-and-database.md&#xff0c;\u8bb2\u89e3\u5982\u4f55\u901a\u8fc7 resolver \u7684 context \u53c2\u6570\u628a Prisma Client \u5b9e\u4f8b\u63a5\u5165 Apollo Server&#xff0c;\u5e76\u628a\u6b64\u524d\u57fa\u4e8e\u5185\u5b58\u6570\u7ec4\u7684 feed \u67e5\u8be2\u4e0e post \u53d8\u66f4\u91cd\u6784\u4e3a\u771f\u5b9e\u6570\u636e\u5e93\u8bfb\u5199\u3002\u8bfb\u5b8c\u672c\u7bc7&#xff0c;\u4f60\u53ef\u4ee5\u72ec\u7acb\u5b8c\u6210&#034;context \u63a5\u7ebf &#043; Nexus \u4e0a\u4e0b\u6587\u7c7b\u578b\u58f0\u660e &#043; resolver \u6301\u4e45\u5316\u6539\u9020 &#043; \u6570\u636e\u6301\u4e45\u6027\u9a8c\u8bc1&#034;\u8fd9\u5957\u5b8c\u6574\u94fe\u8def&#xff0c;\u5e76\u4e3a\u540e\u7eed\u7684\u8ba4\u8bc1\u3001\u7528\u6237\u5173\u8054\u7b49\u8fdb\u9636\u529f\u80fd\u6253\u4e0b\u57fa\u7840\u3002<\/p>\n<h3>\u80cc\u666f&#xff1a;\u672c\u7ae0\u5728\u6559\u7a0b\u4e2d\u7684\u4f4d\u7f6e<\/h3>\n<p>\u5728 HowToGraphQL \u7684 typescript-apollo \u6559\u7a0b\u8f68\u9053\u4e2d&#xff0c;\u672c\u7ae0\u4e4b\u524d\u5df2\u5b8c\u6210\u4ee5\u4e0b\u5de5\u4f5c&#xff08;\u5bf9\u5e94 1-getting-started.md\u30012-a-simple-query.md\u30013-a-simple-mutation.md\u30014-adding-a-database.md&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u7528 Nexus&#xff08;code-first \u65b9\u5f0f&#xff09;\u5b9a\u4e49\u4e86 Link \u5bf9\u8c61\u7c7b\u578b\u4e0e feed \u67e5\u8be2\u3001post \u53d8\u66f4&#xff1b;<\/li>\n<li>\u7528 Apollo Server v3 \u5728 http:\/\/localhost:3000\/ \u542f\u52a8\u4e86 GraphQL \u670d\u52a1&#xff1b;<\/li>\n<li>\u5f15\u5165 Prisma \u751f\u6001&#xff08;Prisma CLI\u3001Prisma Client\u3001Prisma Migrate&#xff09;&#xff0c;\u6267\u884c npx prisma init \u751f\u6210 prisma\/schema.prisma&#xff0c;\u5e76\u5b9a\u4e49\u4e86 Link \u6a21\u578b&#xff1a;<\/li>\n<\/ul>\n<p>\/\/ prisma\/schema.prisma<br \/>\ndatasource db {<br \/>\n  provider &#061; &#034;sqlite&#034;<br \/>\n  url      &#061; &#034;file:.\/dev.db&#034;<br \/>\n}<\/p>\n<p>generator client {<br \/>\n  provider &#061; &#034;prisma-client-js&#034;<br \/>\n}<\/p>\n<p>model Link {<br \/>\n  id          Int      &#064;id &#064;default(autoincrement())<br \/>\n  createdAt   DateTime &#064;default(now())<br \/>\n  description String<br \/>\n  url         String<br \/>\n}<\/p>\n<ul>\n<li>\u901a\u8fc7 npx prisma migrate dev &#8211;name &#034;init&#034; \u521b\u5efa\u4e86 SQLite \u6570\u636e\u5e93\u6587\u4ef6 dev.db&#xff08;\u542b Link \u8868&#xff09;\u5e76\u81ea\u52a8\u751f\u6210 Prisma Client&#xff1b;<\/li>\n<li>\u5728 src\/script.ts \u4e2d\u7528 prisma.link.findMany() \u548c prisma.link.create() \u72ec\u7acb\u9a8c\u8bc1\u8fc7\u6570\u636e\u5e93\u8bfb\u5199\u3002<\/li>\n<\/ul>\n<p>\u4f46\u6b64\u65f6 GraphQL resolver \u4ecd\u7136\u4f9d\u8d56 src\/graphql\/Link.ts \u4e2d\u7684\u5185\u5b58 links \u6570\u7ec4\u548c idCount \u53d8\u91cf&#xff1a;\u4e00\u65e6\u670d\u52a1\u5668\u91cd\u542f&#xff0c;\u6240\u6709&#034;\u63d0\u4ea4&#034;\u7684\u94fe\u63a5\u90fd\u4f1a\u4e22\u5931\u3002\u672c\u7ae0\u8981\u89e3\u51b3\u7684\u5c31\u662f\u8fd9\u4e2a\u95ee\u9898\u2014\u2014\u628a GraphQL \u670d\u52a1\u5668\u4e0e SQLite \u6570\u636e\u5e93\u771f\u6b63\u8fde\u8d77\u6765&#xff0c;\u8ba9\u6570\u636e\u8de8\u8fdb\u7a0b\u751f\u547d\u5468\u671f\u6301\u4e45\u5316\u3002<\/p>\n<h3>\u6838\u5fc3\u673a\u5236&#xff1a;resolver \u7684 context \u53c2\u6570<\/h3>\n<p>\u56de\u987e\u524d\u51e0\u7ae0\u7684\u7ed3\u8bba&#xff1a;\u6bcf\u4e2a GraphQL resolver \u51fd\u6570\u56fa\u5b9a\u63a5\u6536\u56db\u4e2a\u53c2\u6570\u2014\u2014parent&#xff08;\u4e0a\u4e00\u7ea7 resolver \u7684\u7ed3\u679c&#xff09;\u3001args&#xff08;\u64cd\u4f5c\u53c2\u6570&#xff09;\u3001context&#xff08;\u4e0a\u4e0b\u6587\u5bf9\u8c61&#xff09;\u3001info&#xff08;\u6267\u884c\u5143\u4fe1\u606f&#xff09;\u3002\u672c\u7ae0\u805a\u7126\u6b64\u524d\u5c1a\u672a\u5c55\u5f00\u7684 context\u3002<\/p>\n<p>\u6309\u539f\u6587\u6863\u7684\u51c6\u786e\u63cf\u8ff0&#xff1a;<\/p>\n<ul>\n<li>context \u662f\u4e00\u4e2a\u666e\u901a\u7684 JavaScript \u5bf9\u8c61&#xff0c;resolver \u94fe\u4e2d\u7684\u6bcf\u4e00\u4e2a resolver \u90fd\u53ef\u4ee5\u5bf9\u5b83\u8bfb\u548c\u5199&#xff0c;\u56e0\u6b64\u5b83\u672c\u8d28\u4e0a\u662f resolver \u4e4b\u95f4\u901a\u4fe1\u7684\u901a\u9053&#xff1b;<\/li>\n<li>\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u7279\u6027\u662f&#xff1a;\u4f60\u53ef\u4ee5\u5728 GraphQL \u670d\u52a1\u5668\u521d\u59cb\u5316\u65f6\u5c31\u5411 context \u5199\u5165\u5185\u5bb9&#xff1b;<\/li>\n<li>\u7531\u6b64\u5f97\u51fa\u7ed3\u8bba&#xff1a;\u5728 ApolloServer \u521d\u59cb\u5316\u65f6\u628a\u4e00\u4e2a PrismaClient \u5b9e\u4f8b\u6302\u5230 context \u4e0a&#xff0c;\u4e4b\u540e\u6240\u6709 resolver \u90fd\u80fd\u901a\u8fc7 context \u53c2\u6570\u76f4\u63a5\u62ff\u5230\u5b83&#xff0c;\u4ece\u800c\u8bbf\u95ee\u6570\u636e\u5e93\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e5f\u662f\u672c\u7ae0 frontmatter \u4e2d\u914d\u5957\u6d4b\u9a8c\u9898\u7684\u8003\u70b9&#xff1a;<\/p>\n<p>\u95ee\u9898&#xff1a;GraphQL resolver \u4e2d\u7684 context \u53c2\u6570\u6709\u4ec0\u4e48\u4f5c\u7528&#xff1f;<\/p>\n<p>\u6b63\u786e\u7b54\u6848&#xff1a;It lets resolvers communicate with each other&#xff08;\u5b83\u8ba9 resolver \u4e4b\u95f4\u80fd\u591f\u76f8\u4e92\u901a\u4fe1&#xff09;\u3002<\/p>\n<p>\u5176\u4f59\u4e09\u4e2a\u5e72\u6270\u9879&#xff08;&#034;\u603b\u80fd\u63d0\u4f9b\u6570\u636e\u5e93\u8bbf\u95ee&#034;\u3001&#034;\u643a\u5e26\u67e5\u8be2\u53c2\u6570&#034;\u3001&#034;\u7528\u4e8e\u8ba4\u8bc1&#034;&#xff09;\u90fd\u4e0d\u51c6\u786e&#xff1a;context \u5e76\u4e0d\u5929\u7136\u7ed1\u5b9a\u6570\u636e\u5e93&#xff0c;\u643a\u5e26\u53c2\u6570\u7684\u662f args&#xff0c;\u8ba4\u8bc1\u53ea\u662f context \u7684\u5e38\u89c1\u7528\u9014\u4e4b\u4e00&#xff08;\u89c1 6-authentication.md&#xff09;\u3002<\/p>\n<h3>\u7b2c\u4e00\u6b65&#xff1a;\u521b\u5efa context.ts \u5e76\u6302\u8f7d PrismaClient<\/h3>\n<p>\u51fa\u4e8e\u6a21\u5757\u5316\u8003\u8651&#xff0c;\u539f\u6587\u6863\u4e13\u95e8\u7528\u4e00\u4e2a context.ts \u6587\u4ef6\u6765\u627f\u8f7d context \u7684\u521d\u59cb\u5316\u3002\u5728\u9879\u76ee\u7684 src \u76ee\u5f55\u4e0b\u521b\u5efa\u8be5\u6587\u4ef6&#xff1a;<\/p>\n<p># \u9879\u76ee\u6839\u76ee\u5f55\u4e3a hackernews-typescript\/<br \/>\ntouch src\/context.ts<\/p>\n<p>\u7136\u540e\u5728 src\/context.ts \u4e2d\u5b9a\u4e49 Context \u63a5\u53e3\u5e76\u5bfc\u51fa context \u5bf9\u8c61&#xff1a;<\/p>\n<p>\/\/ src\/context.ts<br \/>\nimport { PrismaClient } from &#034;&#064;prisma\/client&#034;;<br \/>\nexport const prisma &#061; new PrismaClient();<\/p>\n<p>export interface Context {    \/\/ 1<br \/>\n    prisma: PrismaClient;<br \/>\n}<\/p>\n<p>export const context: Context &#061; {   \/\/ 2<br \/>\n    prisma,<br \/>\n};<\/p>\n<p>\u9010\u6761\u7406\u89e3&#xff1a;<\/p>\n<ul>\n<li>\/\/ 1&#xff1a;\u5148\u5b9a\u4e49 Context \u63a5\u53e3&#xff0c;\u58f0\u660e context \u5bf9\u8c61\u4e0a\u4f1a\u6302\u54ea\u4e9b\u4e1c\u897f\u3002\u76ee\u524d\u53ea\u6709\u4e00\u4e2a PrismaClient \u5b9e\u4f8b&#xff0c;\u4f46\u968f\u7740\u9879\u76ee\u589e\u957f&#xff08;\u4f8b\u5982\u540e\u7eed\u52a0\u5165\u7528\u6237\u4f1a\u8bdd\u3001\u8ba4\u8bc1\u4fe1\u606f&#xff09;&#xff0c;\u8fd9\u4e2a\u63a5\u53e3\u4f1a\u7ee7\u7eed\u6269\u5c55\u2014\u2014\u8fd9\u6b63\u662f TypeScript&#034;\u5148\u58f0\u660e\u7c7b\u578b\u3001\u518d\u521b\u5efa\u5bf9\u8c61&#034;\u7684\u6807\u51c6\u5de5\u4f5c\u6d41\u5e26\u6765\u7684\u6536\u76ca&#xff1b;<\/li>\n<li>\/\/ 2&#xff1a;\u5bfc\u51fa context \u5bf9\u8c61&#xff0c;\u4f9b GraphQL \u670d\u52a1\u5668&#xff08;index.ts&#xff09;\u5bfc\u5165\u4f7f\u7528\u3002\u540c\u65f6\u6a21\u5757\u9876\u5c42\u5bfc\u51fa\u7684 prisma \u5b9e\u4f8b\u662f\u5355\u4f8b&#xff0c;\u4fdd\u8bc1\u6574\u4e2a\u8fdb\u7a0b\u5171\u4eab\u540c\u4e00\u4e2a\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u3002<\/li>\n<\/ul>\n<h3>\u7b2c\u4e8c\u6b65&#xff1a;\u5411 Nexus \u58f0\u660e context \u7c7b\u578b<\/h3>\n<p>Nexus \u662f code-first \u7684 schema \u6784\u5efa\u5e93&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u751f\u6210 nexus-typegen.ts&#xff08;TypeScript \u7c7b\u578b&#xff09;\u4e0e schema.graphql&#xff08;SDL&#xff09;&#xff0c;\u5e76\u636e\u6b64\u5bf9\u6240\u6709 resolver \u7b7e\u540d\u505a\u7c7b\u578b\u68c0\u67e5\u3002\u4e3a\u4e86\u8ba9 Nexus \u77e5\u9053 context \u7684\u786e\u5207\u7c7b\u578b&#xff0c;\u9700\u8981\u4fee\u6539 src\/schema.ts \u4e2d\u7684 makeSchema \u8c03\u7528&#xff0c;\u65b0\u589e contextType \u914d\u7f6e&#xff1a;<\/p>\n<p>\/\/ src\/schema.ts<br \/>\nexport const schema &#061; makeSchema({<br \/>\n    types,<br \/>\n    outputs: {<br \/>\n        typegen: join(process.cwd(), &#034;nexus-typegen.ts&#034;),<br \/>\n        schema: join(process.cwd(), &#034;schema.graphql&#034;),<br \/>\n    },<br \/>\n    contextType: {<br \/>\n        module: join(process.cwd(), &#034;.\/src\/context.ts&#034;),  \/\/ 1<br \/>\n        export: &#034;Context&#034;,  \/\/ 2<br \/>\n    },<br \/>\n});<\/p>\n<p>\u4e24\u4e2a\u9009\u9879\u7684\u542b\u4e49&#xff1a;<\/p>\n<ul>\n<li>\/\/ 1 module&#xff1a;\u5bfc\u51fa context \u63a5\u53e3&#xff08;\u6216\u7c7b\u578b&#xff09;\u7684\u6587\u4ef6&#xff08;\u4e5f\u79f0\u4f5c\u6a21\u5757&#xff09;\u7684\u8def\u5f84&#xff1b;<\/li>\n<li>\/\/ 2 export&#xff1a;\u8be5\u6a21\u5757\u4e2d\u5bfc\u51fa\u7684\u63a5\u53e3\u540d\u3002<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;Nexus \u4f1a\u786e\u4fdd\u6240\u6709 resolver \u7684 context \u53c2\u6570\u90fd\u5339\u914d Context \u63a5\u53e3\u2014\u2014\u5982\u679c\u5728 resolver \u91cc\u5199 context.xxx \u800c xxx \u4e0d\u5728 Context \u4e2d&#xff0c;TypeScript \u4f1a\u76f4\u63a5\u62a5\u9519\u3002\u8fd9\u4e0e Nexus&#034;\u81ea\u52a8\u751f\u6210\u7c7b\u578b\u3001\u4fdd\u8bc1 schema \u5b9a\u4e49\u4e0e\u5b9e\u73b0\u540c\u6b65&#034;\u7684\u6574\u4f53\u8bbe\u8ba1\u4e00\u8109\u76f8\u627f&#xff08;\u8be5\u673a\u5236\u5728 1-getting-started.md \u4e2d\u5df2\u4ecb\u7ecd&#xff09;\u3002<\/p>\n<h3>\u7b2c\u4e09\u6b65&#xff1a;\u628a context \u63a5\u5165 ApolloServer<\/h3>\n<p>\u5728 src\/index.ts \u4e2d\u5bfc\u5165 context \u5e76\u4f20\u5165 ApolloServer \u6784\u9020\u51fd\u6570&#xff1a;<\/p>\n<p>\/\/ src\/index.ts<br \/>\nimport { context } from &#034;.\/context&#034;;<\/p>\n<p>export const server &#061; new ApolloServer({<br \/>\n    schema,<br \/>\n    context,<br \/>\n});<\/p>\n<p>\u4ece\u6b64&#xff0c;ApolloServer \u5b9e\u4f8b\u5316\u65f6&#xff0c;context \u5bf9\u8c61\u5c31\u5e26\u7740 PrismaClient \u5b9e\u4f8b&#xff08;\u5b57\u6bb5\u540d\u4e3a prisma&#xff09;\u88ab\u521d\u59cb\u5316&#xff1b;\u6240\u6709 resolver \u5185\u90e8\u90fd\u53ef\u4ee5\u7528 context.prisma \u8bbf\u95ee\u6570\u636e\u5e93\u3002<\/p>\n<h3>\u7b2c\u56db\u6b65&#xff1a;\u91cd\u6784 resolver&#xff0c;\u5207\u6362\u5230\u6570\u636e\u5e93\u8bfb\u5199<\/h3>\n<p>\u6570\u636e\u6e90\u6362\u6210\u771f\u5b9e\u6570\u636e\u5e93\u540e&#xff0c;src\/graphql\/Link.ts \u4e2d\u7684\u5185\u5b58 links \u6570\u7ec4\u548c idCount \u53d8\u91cf\u5c31\u6ca1\u6709\u5b58\u5728\u610f\u4e49\u4e86&#xff0c;\u5e94\u6574\u4f53\u5220\u9664\u2014\u2014\u5b83\u4eec\u53ea\u5728\u524d\u4e00\u7ae0\u7684\u5185\u5b58\u65b9\u6848\u4e2d\u8d1f\u8d23\u4e34\u65f6\u5b58\u50a8\u548c\u751f\u6210\u81ea\u589e id&#xff0c;\u800c\u8fd9\u4e24\u9879\u5de5\u4f5c\u73b0\u5728\u5206\u522b\u7531 SQLite \u8868\u548c &#064;id &#064;default(autoincrement()) \u5c5e\u6027\u63a5\u7ba1\u3002<\/p>\n<p>\u9700\u8981\u66f4\u65b0\u7684 resolver \u6709\u4e24\u4e2a&#xff1a;feed \u67e5\u8be2\u548c post \u53d8\u66f4\u3002<\/p>\n<p>\/\/ src\/graphql\/Link.ts<br \/>\nimport { extendType, nonNull, objectType, stringArg } from &#034;nexus&#034;;<\/p>\n<p>export const LinkQuery &#061; extendType({<br \/>\n    type: &#034;Query&#034;,<br \/>\n    definition(t) {<br \/>\n        t.nonNull.list.nonNull.field(&#034;feed&#034;, {<br \/>\n            type: &#034;Link&#034;,<br \/>\n            resolve(parent, args, context) {<br \/>\n                return context.prisma.link.findMany();  \/\/ 1<br \/>\n            },<br \/>\n        });<br \/>\n    },<br \/>\n});<\/p>\n<p>export const LinkMutation &#061; extendType({<br \/>\n    type: &#034;Mutation&#034;,<br \/>\n    definition(t) {<br \/>\n        t.nonNull.field(&#034;post&#034;, {<br \/>\n            type: &#034;Link&#034;,<br \/>\n            args: {<br \/>\n                description: nonNull(stringArg()),<br \/>\n                url: nonNull(stringArg()),<br \/>\n            },<br \/>\n            resolve(parent, args, context) {<br \/>\n                const newLink &#061; context.prisma.link.create({   \/\/ 2<br \/>\n                    data: {<br \/>\n                        description: args.description,<br \/>\n                        url: args.url,<br \/>\n                    },<br \/>\n                });<br \/>\n                return newLink;<br \/>\n            },<br \/>\n        });<br \/>\n    },<br \/>\n});<\/p>\n<p>\u4e24\u4e2a\u5173\u952e\u6539\u52a8&#xff1a;<\/p>\n<ul>\n<li>\/\/ 1 feed resolver&#xff1a;\u901a\u8fc7 context.prisma \u62ff\u5230 Prisma Client \u5b9e\u4f8b&#xff0c;\u8c03\u7528 findMany() \u67e5\u8be2\u5e76\u8fd4\u56de\u6570\u636e\u5e93\u4e2d\u5168\u90e8 Link \u8bb0\u5f55&#xff1b;<\/li>\n<li>\/\/ 2 post resolver&#xff1a;\u5bf9 Link \u6a21\u578b\u8c03\u7528 Prisma Client \u7684 create \u65b9\u6cd5&#xff0c;\u628a resolver \u4ece args \u53c2\u6570\u4e2d\u6536\u5230\u7684 description \u4e0e url \u4f5c\u4e3a data \u4f20\u5165&#xff0c;\u8fd4\u56de\u65b0\u521b\u5efa\u7684 Link \u5bf9\u8c61\u3002\u6ce8\u610f id \u4e0e createdAt \u65e0\u9700\u624b\u52a8\u586b\u5199&#xff1a;schema.prisma \u4e2d &#064;id &#064;default(autoincrement()) \u4e0e &#064;default(now()) \u4f1a\u7531\u6570\u636e\u5e93\/Prisma \u81ea\u52a8\u586b\u5145\u3002<\/li>\n<\/ul>\n<p>\u6ce8\u610f&#xff08;\u5f02\u6b65\u8bed\u4e49&#xff09;&#xff1a;Prisma \u7684\u67e5\u8be2\u65b9\u6cd5\u8fd4\u56de Promise \u5bf9\u8c61&#xff0c;\u56e0\u4e3a\u6570\u636e\u5e93\u8bbf\u95ee\u662f\u5f02\u6b65\u7684\u3002\u56e0\u6b64\u4e0a\u9762\u4e24\u4e2a resolver \u5b9e\u9645\u90fd\u662f\u8fd4\u56de\u4e00\u4e2a Promise\u3002\u8fd9\u4e0d\u662f\u95ee\u9898\u2014\u2014Apollo Server \u80fd\u591f\u68c0\u6d4b resolver \u8fd4\u56de\u7684 Promise \u5e76\u81ea\u52a8\u89e3\u6790\u5176\u7ed3\u679c&#xff0c;\u65e0\u9700\u5728 resolver \u5185\u624b\u52a8 await\u3002<\/p>\n<h3>\u9a8c\u8bc1&#xff1a;\u6570\u636e\u5df2\u6301\u4e45\u5316\u5230 SQLite<\/h3>\n<p>\u6539\u9020\u5b8c\u6210\u540e\u542f\u52a8\u670d\u52a1&#xff08;npm run dev&#xff0c;\u5373 ts-node-dev &#8211;transpile-only &#8211;no-notify &#8211;exit-child src\/index.ts&#xff09;&#xff0c;\u5728 Apollo Studio \u4e2d\u53d1\u9001\u4e0e\u524d\u51e0\u7ae0\u76f8\u540c\u7684 feed \u67e5\u8be2\u548c post \u53d8\u66f4&#xff1a;<\/p>\n<p># \u67e5\u8be2\u6240\u6709\u94fe\u63a5<br \/>\nquery {<br \/>\n  feed {<br \/>\n    id<br \/>\n    url<br \/>\n    description<br \/>\n  }<br \/>\n}<\/p>\n<p># \u63d0\u4ea4\u4e00\u6761\u65b0\u94fe\u63a5<br \/>\nmutation {<br \/>\n  post(url: &#034;www.prisma.io&#034;, description: &#034;Next-generation Node.js and TypeScript ORM&#034;) {<br \/>\n    id<br \/>\n  }<br \/>\n}<\/p>\n<p>\u4e0e\u524d\u51e0\u7ae0\u7684\u552f\u4e00\u533a\u522b\u5728\u4e8e&#xff1a;\u8fd9\u6b21\u63d0\u4ea4\u7684\u94fe\u63a5\u4f1a\u88ab\u6301\u4e45\u5316\u5230 prisma\/schema.prisma \u4e2d url &#061; &#034;file:.\/dev.db&#034; \u6307\u5411\u7684 SQLite \u6570\u636e\u5e93\u6587\u4ef6\u91cc\u3002\u56e0\u6b64\u5373\u4f7f\u6740\u6389\u8fdb\u7a0b\u3001\u91cd\u542f\u670d\u52a1\u5668&#xff0c;\u518d\u6b21\u6267\u884c feed \u67e5\u8be2\u4f9d\u7136\u80fd\u62ff\u5230\u4e4b\u524d\u521b\u5efa\u7684\u6240\u6709\u94fe\u63a5\u2014\u2014\u8fd9\u6b63\u662f\u672c\u7ae0\u6539\u9020\u7684\u76f4\u63a5\u53ef\u89c2\u6d4b\u6548\u679c&#xff0c;\u4e5f\u662f\u4e0e&#034;\u5185\u5b58\u6570\u7ec4\u65b9\u6848&#034;\u7684\u672c\u8d28\u5206\u754c\u7ebf\u3002<\/p>\n<p>\u987a\u5e26\u56de\u987e\u539f\u6587\u6863\u603b\u7ed3\u7684\u6807\u51c6\u5de5\u4f5c\u6d41&#xff1a;\u6bcf\u5f53\u6570\u636e\u53d1\u751f\u53d8\u5316&#xff0c;\u6309&#034;\u4fee\u6539 Prisma \u6570\u636e\u6a21\u578b \u2192 \u7528 prisma migrate \u8fc1\u79fb\u6570\u636e\u5e93 \u2192 &#xff08;\u91cd\u65b0&#xff09;\u751f\u6210 Prisma Client \u2192 \u5728\u5e94\u7528\u4ee3\u7801\u4e2d\u4f7f\u7528 Prisma Client&#034;\u7684\u987a\u5e8f\u63a8\u8fdb\u5373\u53ef\u3002<\/p>\n<h3>\u7406\u89e3 PrismaClient&#xff1a;\u7531 schema.prisma \u751f\u6210\u7684 CRUD API<\/h3>\n<p>\u4ece\u6574\u4f53\u7cfb\u7edf\u89c6\u89d2\u770b&#xff0c;\u672c\u7ae0\u8865\u9f50\u4e86 Prisma\/GraphQL \u9879\u76ee\u7684\u5b8c\u6574\u95ed\u73af&#xff1a;<\/p>\n<li>schema.prisma \u4e2d\u7684\u6570\u636e\u6a21\u578b&#xff08;\u5982 Link&#xff09;\u5b9a\u4e49\u4e86\u6570\u636e\u5e93\u7ed3\u6784&#xff1b;<\/li>\n<li>Prisma Client \u57fa\u4e8e\u8fd9\u4e9b\u6a21\u578b\u81ea\u52a8\u751f\u6210\u4e00\u5957\u7c7b\u578b\u5b89\u5168\u7684 CRUD API\u2014\u2014PrismaClient \u5b9e\u4f8b\u53ef\u4ee5\u8bbf\u95ee\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u6a21\u578b&#xff0c;\u5bf9\u6bcf\u4e2a\u6a21\u578b\u66b4\u9732 findMany\u3001create\u3001update\u3001delete \u7b49\u64cd\u4f5c&#xff0c;\u8ba9\u4f60\u5b8c\u6210\u521b\u5efa\u3001\u8bfb\u53d6\u3001\u66f4\u65b0\u3001\u5220\u9664\u5168\u94fe\u8def\u64cd\u4f5c&#xff1b;<\/li>\n<li>GraphQL resolver \u4f5c\u4e3a&#034;\u6d88\u8d39\u7aef&#034;&#xff0c;\u5229\u7528\u8fd9\u5957 Prisma Client API \u6267\u884c query \u4e0e mutation \u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u5e76\u628a\u7ed3\u679c\u8fd4\u56de\u7ed9 GraphQL \u6267\u884c\u5f15\u64ce\u3002<\/li>\n<p>\u6362\u53e5\u8bdd\u8bf4&#xff0c;Prisma Client \u5c31\u662f schema.prisma \u6a21\u578b\u5b9a\u4e49\u5230\u5e94\u7528\u4ee3\u7801\u4e4b\u95f4\u7684\u6865\u6881&#xff1a;\u6a21\u578b\u600e\u4e48\u5199&#xff0c;CRUD \u65b9\u6cd5\u5c31\u957f\u4ec0\u4e48\u6837&#xff0c;\u4e14\u5168\u90e8\u5e26 TypeScript \u7c7b\u578b&#xff08;\u8fd9\u6b63\u662f\u539f\u6587\u6863\u9f13\u52b1\u8bfb\u8005\u4eb2\u624b\u8f93\u5165\u4ee3\u7801\u3001\u5229\u7528\u81ea\u52a8\u8865\u5168\u63a2\u7d22 API \u7684\u539f\u56e0&#xff09;\u3002<\/p>\n<h3>\u540e\u7eed\u5ef6\u4f38&#xff1a;context \u7684\u6269\u5c55\u4ef7\u503c<\/h3>\n<p>\u672c\u7ae0\u53ea\u5f80 context \u4e0a\u6302\u4e86\u4e00\u4e2a prisma&#xff0c;\u4f46\u8fd9\u4e2a\u62bd\u8c61\u7684\u56de\u62a5\u4f1a\u968f\u9879\u76ee\u590d\u6742\u5ea6\u4e0a\u5347\u800c\u653e\u5927\u3002\u7d27\u63a5\u7740\u7684 6-authentication.md \u5c31\u7ed9\u51fa\u4e86\u8303\u4f8b&#xff1a;\u5728 Prisma \u6570\u636e\u6a21\u578b\u4e2d\u65b0\u589e User \u6a21\u578b\u3001\u6267\u884c npx prisma migrate dev &#8211;name &#034;add-user-model&#034; \u8fc1\u79fb\u540e&#xff0c;src\/graphql\/User.ts \u4e2d\u7684 resolver \u4f9d\u7136\u901a\u8fc7\u540c\u4e00\u4e2a context.prisma \u5b8c\u6210 findUnique \u7b49\u64cd\u4f5c\u3002\u7531\u4e8e Context \u63a5\u53e3\u5df2\u5728 context.ts \u4e2d\u96c6\u4e2d\u58f0\u660e&#xff0c;\u672a\u6765\u82e5\u9700\u8ffd\u52a0\u4f1a\u8bdd\u7528\u6237\u3001\u9274\u6743\u5934\u7b49\u5b57\u6bb5&#xff0c;\u53ea\u9700\u6269\u5c55\u63a5\u53e3\u5e76\u540c\u6b65 makeSchema \u7684 contextType \u58f0\u660e&#xff0c;Nexus \u7684\u7c7b\u578b\u68c0\u67e5\u4f1a\u8986\u76d6\u5230\u6240\u6709 resolver\u3002<\/p>\n<h3>\u9644\u5f55&#xff1a;\u672c\u7bc7\u5185\u5bb9\u5728 HowToGraphQL \u4ed3\u5e93\u4e2d\u7684\u627f\u8f7d\u65b9\u5f0f<\/h3>\n<p>\u4f5c\u4e3a\u8865\u5145\u8bf4\u660e&#xff0c;\u672c\u4ed3\u5e93\u672c\u8eab\u662f\u7528 Gatsby \u6784\u5efa\u7684\u6559\u7a0b\u7ad9\u70b9&#xff1a;meta\/writing-guidelines.md \u89c4\u5b9a\u6bcf\u7ae0\u5fc5\u987b\u662f\u5e26 frontmatter&#xff08;title\u3001description\u3001question\u3001answers\u3001correctAnswer&#xff09;\u7684\u5355\u4e2a Markdown \u6587\u4ef6&#xff0c;\u5176\u4e2d\u540e\u4e09\u9879\u5b9a\u4e49\u4e86\u7ae0\u672b\u7684\u9009\u62e9\u9898&#xff1b;\u6b63\u6587\u4e2d\u7684\u64cd\u4f5c\u6b65\u9aa4\u4f7f\u7528 &lt;Instruction&gt; \u6807\u7b7e\u6807\u6ce8&#xff0c;\u7531 src\/components\/Tutorials\/Instruction.tsx \u6e32\u67d3\u6210\u9ad8\u4eae\u64cd\u4f5c\u5757&#xff0c;\u7ae0\u672b\u6d4b\u9a8c\u5219\u7531 src\/components\/Quiz\/Quiz.tsx \u6839\u636e frontmatter \u6570\u636e\u6e32\u67d3\u3002\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u4f60\u5728\u4ed3\u5e93\u91cc\u8bfb\u5230\u7684\u8fd9\u4e00\u7ae0&#xff0c;\u65e2\u662f\u6559\u5b66\u6587\u672c&#xff0c;\u4e5f\u662f\u4e00\u5957\u88ab\u7ad9\u70b9\u7ec4\u4ef6\u76f4\u63a5\u6d88\u8d39\u7684\u7ed3\u6784\u5316\u5185\u5bb9\u3002<\/p>\n<h3>\u5c0f\u7ed3<\/h3>\n<p>\u672c\u7ae0\u5b8c\u6210\u4e86 HowToGraphQL typescript-apollo \u6559\u7a0b\u4e2d\u7684\u5173\u952e\u4e00\u6b65&#xff1a;\u501f\u52a9 resolver \u7684 context \u53c2\u6570&#xff0c;\u628a Prisma Client \u4ece&#034;\u811a\u672c\u91cc\u7684\u4e00\u6b21\u6027\u5de5\u5177&#034;\u53d8\u6210\u4e86&#034;\u670d\u52a1\u5668\u5168\u751f\u547d\u5468\u671f\u7684\u5171\u4eab\u4f9d\u8d56&#034;\u3002\u4e09\u5904\u6539\u52a8&#xff08;context.ts \u5b9a\u4e49\u4e0a\u4e0b\u6587\u3001schema.ts \u58f0\u660e contextType\u3001index.ts \u4f20\u5165 context&#xff09;\u52a0\u4e0a resolver \u7684\u4e24\u5904\u66ff\u6362&#xff08;links \u6570\u7ec4 \u2192 prisma.link.findMany()&#xff0c;\u624b\u5de5 push \u2192 prisma.link.create()&#xff09;&#xff0c;\u5373\u5b9e\u73b0\u4e86\u4ece\u5185\u5b58\u5b58\u50a8\u5230 SQLite \u6301\u4e45\u5316\u7684\u5e73\u6ed1\u8fc1\u79fb&#xff0c;\u540c\u65f6\u5168\u7a0b\u4fdd\u7559\u4e86 Nexus &#043; TypeScript \u7684\u7aef\u5230\u7aef\u7c7b\u578b\u5b89\u5168\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003015707-6ac060f32ea36.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011howtographql<\/h3>\n<p class=\"gcb-project-desc\">The Fullstack Tutorial for GraphQL<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/ho\/howtographql<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">TypeScript &#043; Apollo \u5b9e\u6218&#xff1a;\u7528 Prisma \u4e3a HackerNews GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93<\/h5>\n<p class=\"gcb-related-item-desc\">TypeScript &#043; Apollo \u5b9e\u6218&#xff1a;\u7528 Prisma \u4e3a HackerNews GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 \u672c\u6587\u662f howtog<\/p>\n<\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u4ece\u96f6\u6784\u5efa GraphQL \u670d\u52a1\u5668&#xff1a;graphql-yoga \u5b9e\u6218\u4e0e Prisma \u6570\u636e\u5e93\u63a5\u5165\u6307\u5357<\/h5>\n<p class=\"gcb-related-item-desc\">\u4ece\u96f6\u6784\u5efa GraphQL \u670d\u52a1\u5668&#xff1a;graphql yoga \u5b9e\u6218\u4e0e Prisma \u6570\u636e\u5e93\u63a5\u5165\u6307\u5357 \u672c\u6559\u7a0b\u5e26\u4f60\u4ece\u96f6\u5f00\u59cb&#xff0c;\u4f7f\u7528 graphql yoga \u642d\u5efa\u4e00\u4e2a\u529f<\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">\u6570\u636e\u5e93<\/span><br \/>\n     <span class=\"gcb-tag\">GraphQL<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">Prisma 1 &#043; graphql-yoga \u4ece\u96f6\u6784\u5efa GraphQL \u670d\u52a1\u5668&#xff1a;Schema\u3001Resolver \u4e0e\u6570\u636e\u5e93\u63a5\u5165\u5b9e\u6218<\/h5>\n<p class=\"gcb-related-item-desc\">Prisma 1 &#043; graphql yoga \u4ece\u96f6\u6784\u5efa GraphQL \u670d\u52a1\u5668&#xff1a;Schema\u3001Resolver \u4e0e\u6570\u636e\u5e93\u63a5\u5165\u5b9e\u6218 \u672c\u6587\u57fa\u4e8e\u5f53\u524d\u4ed3\u5e93\u7684\u5b98\u65b9\u6559\u7a0b\u6587<\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">\u6570\u636e\u5e93<\/span><br \/>\n     <span class=\"gcb-tag\">GraphQL<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  7\u4e2a\u5173\u952e\u6b65\u9aa4\u6253\u9020\u5b8c\u7f8e\u97f3\u4e50\u4f53\u9a8c&#xff1a;\u4ece\u96f6\u5f00\u59cb\u914d\u7f6eMusicPlayer2\u5168\u6307\u5357 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u6781\u81f4\u97f3\u9891\u4f53\u9a8c&#xff1a;5\u6b65\u638c\u63e1MusicPlayer2\u5168\u80fd\u64ad\u653e\u5668 <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011howtographql The Fullstack Tutorial for GraphQL \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/ho\/howtographql \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d  \u672c\u6587\u57fa\u4e8e HowToGraphQL \u6559\u7a0b\u4ed3\u5e93&#xff08;The Fullstack Tutorial for GraphQL&#xff09;\u4e2d TypeScript  Nexus  Apollo Server \u540e\u7aef\u6559\u7a0b\u7684\u7b2c<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-112355","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/112355.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011howtographql The Fullstack Tutorial for GraphQL \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/ho\/howtographql \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u6587\u57fa\u4e8e HowToGraphQL \u6559\u7a0b\u4ed3\u5e93&#xff08;The Fullstack Tutorial for GraphQL&#xff09;\u4e2d TypeScript Nexus Apollo Server \u540e\u7aef\u6559\u7a0b\u7684\u7b2c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/112355.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-03T01:57:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003015707-6ac060f32ea36.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112355.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/112355.html\",\"name\":\"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-03T01:57:08+00:00\",\"dateModified\":\"2026-10-03T01:57:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/112355.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/112355.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112355.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/112355.html","og_locale":"zh_CN","og_type":"article","og_title":"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011howtographql The Fullstack Tutorial for GraphQL \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/ho\/howtographql \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u6587\u57fa\u4e8e HowToGraphQL \u6559\u7a0b\u4ed3\u5e93&#xff08;The Fullstack Tutorial for GraphQL&#xff09;\u4e2d TypeScript Nexus Apollo Server \u540e\u7aef\u6559\u7a0b\u7684\u7b2c","og_url":"https:\/\/www.wsisp.com\/helps\/112355.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-03T01:57:08+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261003015707-6ac060f32ea36.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/112355.html","url":"https:\/\/www.wsisp.com\/helps\/112355.html","name":"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-03T01:57:08+00:00","dateModified":"2026-10-03T01:57:08+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/112355.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/112355.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/112355.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"HowToGraphQL\uff1a\u7528 Prisma Client \u5c06 TypeScript\/Apollo GraphQL \u670d\u52a1\u5668\u63a5\u5165 SQLite \u6570\u636e\u5e93"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=112355"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112355\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=112355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=112355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=112355"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=112355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}