menu

Prisma

🔴 The Prisma Spectrum community is not officially managed by Prisma's support team any more. Please seek help on GitHub or on Slack instead. Learn more: https://spectrum.chat/prisma/general/where-and-how-to-best-seek-help-with-questions-problems~687a1b8f-8658-4df3-8849-ea5ab3503f28

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Beta
view-forward
# Community
view-forward
# GraphQL
view-forward
# OSS
view-forward
# Random
view-forward
Team

Using Nexus with apollo-server-micro/graphql-yoga-lambda

May 20, 2019 at 10:47pm

Using Nexus with apollo-server-micro/graphql-yoga-lambda

May 20, 2019 at 10:47pm (Edited 1 year ago)
What's the best way to use Nexus with apollo-server-micro? Is it possible to generate types for Nexus manually (e.g. with an npm script)? Because I'm just exporting a function, I never end up "running the server."
Here's my code:
import { ApolloServer } from 'apollo-server-micro'
import { makeSchema, queryType, stringArg } from 'nexus'
const Query = queryType({
definition(t) {
t.string('hello', {
args: { name: stringArg({ nullable: true }) },
resolve: (parent, { name }) => `Hello ${name || 'World'}!`,
})
},
})
const schema = makeSchema({
types: [Query],
outputs: {
schema: __dirname + '/__generated__/schema.graphql',
typegen: __dirname + '/__generated__/nexus.ts',
},
})
const server = new ApolloServer({
schema,
introspection: true,
playground: true,
})
export default server.createHandler()

May 23, 2019 at 4:45pm
I'm also interested in hearing suggestions around this too :D
  • reply
  • like

August 1, 2019 at 9:17pm
Did y'all figure out anything for this?
  • reply
  • like