Skip to content

Commit

Permalink
update examples & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
v1rtl committed Mar 15, 2023
1 parent 740d7f6 commit 99ff768
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Universal [GraphQL](https://www.graphql.com/) HTTP middleware for Deno.
The simplest setup with `std/http`:

```ts
import { Server } from 'https://deno.land/std@0.148.0/http/server.ts'
import { GraphQLHTTP } from '../mod.ts'
import { makeExecutableSchema } from 'https://deno.land/x/graphql_tools@0.0.2/mod.ts'
import { gql } from 'https://deno.land/x/graphql_tag@0.0.1/mod.ts'
import { Server } from 'https://deno.land/std@0.179.0/http/server.ts'
import { GraphQLHTTP } from 'https://deno.land/x/gql/mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/schema@9.0.17'
import { gql } from 'https://deno.land/x/graphql_tag@0.1.1/mod.ts'

const typeDefs = gql`
type Query {
Expand All @@ -47,12 +47,12 @@ const s = new Server({

return pathname === '/graphql'
? await GraphQLHTTP<Request>({
schema: makeExecutableSchema({ resolvers, typeDefs }),
graphiql: true,
})(req)
schema: makeExecutableSchema({ resolvers, typeDefs }),
graphiql: true
})(req)
: new Response('Not Found', { status: 404 })
},
addr: ':3000',
addr: ':3000'
})

s.listenAndServe()
Expand Down
6 changes: 3 additions & 3 deletions examples/oak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
Application,
Middleware,
Router,
} from 'https://deno.land/x/oak@v11.1.0/mod.ts'
} from 'https://deno.land/x/oak@v12.1.0/mod.ts'
import { GraphQLHTTP } from '../mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected].16'
import { gql } from 'https://deno.land/x/[email protected].0/mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected].17'
import { gql } from 'https://deno.land/x/[email protected].1/mod.ts'

const typeDefs = gql`
type Query {
Expand Down
9 changes: 5 additions & 4 deletions examples/opine.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { opine, OpineRequest } from 'https://deno.land/x/[email protected]/mod.ts'
import { GraphQLHTTP } from '../mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected]'
import { gql } from 'https://deno.land/x/[email protected]/mod.ts'
import { readAll } from 'https://deno.land/[email protected]/streams/read_all.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected]'
import { gql } from 'https://deno.land/x/[email protected]/mod.ts'
import { readAll } from 'https://deno.land/[email protected]/streams/read_all.ts'
import type { GraphQLParams } from '../types.ts'

type Request = OpineRequest & { json: () => Promise<any> }
type Request = OpineRequest & { json: () => Promise<GraphQLParams> }

const typeDefs = gql`
type Query {
Expand Down
6 changes: 3 additions & 3 deletions examples/vanilla.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Server } from 'https://deno.land/std@0.177.0/http/server.ts'
import { Server } from 'https://deno.land/std@0.179.0/http/server.ts'
import { GraphQLHTTP } from '../mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected].16'
import { gql } from 'https://deno.land/x/[email protected].0/mod.ts'
import { makeExecutableSchema } from 'https://esm.sh/@graphql-tools/[email protected].17'
import { gql } from 'https://deno.land/x/[email protected].1/mod.ts'

const typeDefs = gql`
type Query {
Expand Down

0 comments on commit 99ff768

Please sign in to comment.