-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
72 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export type { FreshContext } from "https://deno.land/x/[email protected]/server.ts"; | ||
export { assert } from "jsr:@std/assert@^0.219.1/assert"; | ||
export * as colors from "jsr:@std/fmt@^0.219.1/colors"; | ||
export { ensureDir } from "jsr:@std/fs@^0.219.1/ensure_dir"; | ||
|
@@ -32,6 +33,7 @@ export { | |
type SchemaMapper, | ||
type UnionTypeMapper, | ||
} from "npm:@graphql-tools/utils@^10.1.0"; | ||
export { createYoga } from "npm:graphql-yoga@^5.3.0"; | ||
export { | ||
defaultFieldResolver, | ||
type DirectiveDefinitionNode, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,4 @@ | ||
import { type FreshContext } from "$fresh/server.ts"; | ||
import { fromManifest } from "@vicary/fresh-graphql"; | ||
import { createYoga } from "graphql-yoga"; | ||
import { createHandler } from "@vicary/fresh-graphql"; | ||
import manifest from "../graphql.gen.ts"; | ||
|
||
// FRSH_GQL_DEV is set when you start the GraphQL development server in dev.ts. | ||
const debug = Deno.env.has("FRSH_GQL_DEV"); | ||
|
||
const yoga = createYoga<FreshContext>({ | ||
graphiql: debug, | ||
logging: debug, | ||
maskedErrors: !debug, | ||
schema: fromManifest(manifest), | ||
}); | ||
|
||
export const handler = async (req: Request, ctx: FreshContext) => { | ||
return await yoga.handleRequest(req, ctx); | ||
}; | ||
export const handler = createHandler(manifest); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createYoga, type FreshContext } from "./deps.ts"; | ||
import type { Manifest } from "./schema.ts"; | ||
import { fromManifest } from "./schema.ts"; | ||
|
||
export type CreateHandlerOptions = { | ||
debug?: boolean; | ||
}; | ||
|
||
export function createHandler<TManifest extends Manifest>( | ||
manifest: TManifest, | ||
options?: CreateHandlerOptions, | ||
) { | ||
// FRSH_GQL_DEV is set when you start the GraphQL development server in dev.ts. | ||
const debug = options?.debug ?? Deno.env.has("FRSH_GQL_DEV"); | ||
|
||
const yoga = createYoga<FreshContext>({ | ||
graphiql: debug, | ||
logging: debug, | ||
maskedErrors: !debug, | ||
schema: fromManifest(manifest), | ||
}); | ||
|
||
return async (req: Request, ctx: FreshContext) => { | ||
return await yoga.handleRequest(req, ctx); | ||
}; | ||
} |
c68f517
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to deploy: