markdown 来自graphql-yoga(后端)的prisma服务器连接测试

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 来自graphql-yoga(后端)的prisma服务器连接测试相关的知识,希望对你有一定的参考价值。

```js
const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: request => ({
    ...request,
    // prisma,
    prisma
  }),
  // middlewares: [logInput, logResult],
})
server.start((options) => {
  console.log(`Server is running on...${JSON.stringify(options, null, 2)}`)
  console.log('App secrect', process.env.APP_SECRET)
  console.log(`prisma local endpoint: ${process.env.PRISMA_LOCAL_ENDPOINT}`)
  // console.log(`prisma remote(aws_fargate..deprecated) endpoint: ${process.env.PRISMA_AWS_FARGATE_ENDPOINT}`)
  console.log(`prisma demo endpoint: ${process.env.PRISMA_DEMO_ENDPOINT}`)
  
  //Prisma connection test by querying existing user
  const userAlias = process.env.TEST_USER_ALIAS
  console.log(`Prisma server connection test: query user with alias "${userAlias}"`)
  prisma.$exists.user({alias: userAlias}).then((result)=>{
    console.log(`user with alias "${userAlias}" exists? ${result}`)
  })
})
```
when I see the bottom `server.start()` there are 

```
  //Prisma connection test by querying existing user
  const userAlias = process.env.TEST_USER_ALIAS
  console.log(`Prisma server connection test: query user with alias "${userAlias}"`)
  prisma.$exists.user({alias: userAlias}).then((result)=>{
    console.log(`user with alias "${userAlias}" exists? ${result}`)
  })
```

this line is good for prisma testing(the user is already seeded by defalt)

以上是关于markdown 来自graphql-yoga(后端)的prisma服务器连接测试的主要内容,如果未能解决你的问题,请参考以下文章

将 Stripe webhook 与 graphql-yoga 和 Prisma 一起使用

markdown 使用ramda通过嵌套值过滤对象数组:有时您无权访问后端,并且您希望过滤来自

如何关闭graphql-yoga服务器?

在 graphql-yoga 中返回枚举的解析器函数是啥样的?

无法通过 Prisma 在 GraphQL-yoga 中使用片段

graphql-yoga - GraphQL 解析器参数在哪里定义和记录?