Skip to content

Commit 496f299

Browse files
Merge pull request #34 from timecode/update
updates apollo (3.3.0) and graphql (15.6.0)
2 parents 953aa5d + 9b90466 commit 496f299

14 files changed

+2290
-742
lines changed

.gitignore

+209-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,217 @@
1-
# Hugo default output directory
2-
/public
1+
# Created by https://www.toptal.com/developers/gitignore/api/rust,node,macos,linux,windows
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,node,macos,linux,windows
33

4-
# Serverless config
5-
node_modules
6-
.serverless
4+
### Linux ###
5+
*~
76

8-
## OS Files
9-
# Windows
7+
# temporary files which can be created if a process still has a handle open of a deleted file
8+
.fuse_hidden*
9+
10+
# KDE directory preferences
11+
.directory
12+
13+
# Linux trash folder which might appear on any partition or disk
14+
.Trash-*
15+
16+
# .nfs files are created when an open file is removed but is still being accessed
17+
.nfs*
18+
19+
### macOS ###
20+
# General
21+
.DS_Store
22+
.AppleDouble
23+
.LSOverride
24+
25+
# Icon must end with two \r
26+
Icon
27+
28+
29+
# Thumbnails
30+
._*
31+
32+
# Files that might appear in the root of a volume
33+
.DocumentRevisions-V100
34+
.fseventsd
35+
.Spotlight-V100
36+
.TemporaryItems
37+
.Trashes
38+
.VolumeIcon.icns
39+
.com.apple.timemachine.donotpresent
40+
41+
# Directories potentially created on remote AFP share
42+
.AppleDB
43+
.AppleDesktop
44+
Network Trash Folder
45+
Temporary Items
46+
.apdisk
47+
48+
### Node ###
49+
# Logs
50+
logs
51+
*.log
52+
npm-debug.log*
53+
yarn-debug.log*
54+
yarn-error.log*
55+
lerna-debug.log*
56+
.pnpm-debug.log*
57+
58+
# Diagnostic reports (https://nodejs.org/api/report.html)
59+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
60+
61+
# Runtime data
62+
pids
63+
*.pid
64+
*.seed
65+
*.pid.lock
66+
67+
# Directory for instrumented libs generated by jscoverage/JSCover
68+
lib-cov
69+
70+
# Coverage directory used by tools like istanbul
71+
coverage
72+
*.lcov
73+
74+
# nyc test coverage
75+
.nyc_output
76+
77+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
78+
.grunt
79+
80+
# Bower dependency directory (https://bower.io/)
81+
bower_components
82+
83+
# node-waf configuration
84+
.lock-wscript
85+
86+
# Compiled binary addons (https://nodejs.org/api/addons.html)
87+
build/Release
88+
89+
# Dependency directories
90+
node_modules/
91+
jspm_packages/
92+
93+
# Snowpack dependency directory (https://snowpack.dev/)
94+
web_modules/
95+
96+
# TypeScript cache
97+
*.tsbuildinfo
98+
99+
# Optional npm cache directory
100+
.npm
101+
102+
# Optional eslint cache
103+
.eslintcache
104+
105+
# Microbundle cache
106+
.rpt2_cache/
107+
.rts2_cache_cjs/
108+
.rts2_cache_es/
109+
.rts2_cache_umd/
110+
111+
# Optional REPL history
112+
.node_repl_history
113+
114+
# Output of 'npm pack'
115+
*.tgz
116+
117+
# Yarn Integrity file
118+
.yarn-integrity
119+
120+
# dotenv environment variables file
121+
.env
122+
.env.test
123+
.env.production
124+
125+
# parcel-bundler cache (https://parceljs.org/)
126+
.cache
127+
.parcel-cache
128+
129+
# Next.js build output
130+
.next
131+
out
132+
133+
# Nuxt.js build / generate output
134+
.nuxt
135+
dist
136+
137+
# Gatsby files
138+
.cache/
139+
# Comment in the public line in if your project uses Gatsby and not Next.js
140+
# https://nextjs.org/blog/next-9-1#public-directory-support
141+
# public
142+
143+
# vuepress build output
144+
.vuepress/dist
145+
146+
# Serverless directories
147+
.serverless/
148+
149+
# FuseBox cache
150+
.fusebox/
151+
152+
# DynamoDB Local files
153+
.dynamodb/
154+
155+
# TernJS port file
156+
.tern-port
157+
158+
# Stores VSCode versions used for testing VSCode extensions
159+
.vscode-test
160+
161+
# yarn v2
162+
.yarn/cache
163+
.yarn/unplugged
164+
.yarn/build-state.yml
165+
.yarn/install-state.gz
166+
.pnp.*
167+
168+
### Node Patch ###
169+
# Serverless Webpack directories
170+
.webpack/
171+
172+
### Rust ###
173+
# Generated by Cargo
174+
# will have compiled files and executables
175+
debug/
176+
target/
177+
178+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
179+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
180+
Cargo.lock
181+
182+
# These are backup files generated by rustfmt
183+
**/*.rs.bk
184+
185+
# MSVC Windows builds of rustc generate these, which store debugging information
186+
*.pdb
187+
188+
### Windows ###
189+
# Windows thumbnail cache files
10190
Thumbs.db
191+
Thumbs.db:encryptable
11192
ehthumbs.db
12-
Desktop.ini
193+
ehthumbs_vista.db
194+
195+
# Dump file
196+
*.stackdump
197+
198+
# Folder config file
199+
[Dd]esktop.ini
200+
201+
# Recycle Bin used on file shares
13202
$RECYCLE.BIN/
14203

15-
# OSX
16-
.DS_Store
204+
# Windows Installer files
205+
*.cab
206+
*.msi
207+
*.msix
208+
*.msm
209+
*.msp
17210

18-
dist
19-
.env
211+
# Windows shortcuts
212+
*.lnk
213+
214+
# End of https://www.toptal.com/developers/gitignore/api/rust,node,macos,linux,windows
215+
216+
### Cloudflare ###
20217
worker

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore artifacts:
2+
dist
3+
node_modules
4+
worker
5+
package*

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"trailingComma": "all",
5+
"tabWidth": 2,
6+
"printWidth": 80
7+
}

README.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,34 @@ Why this rules: Cloudflare Workers is a serverless application platform for depl
66

77
By the way - as a full-stack developer who _loves_ GraphQL, and the developer advocate for Cloudflare Workers, I would love to see what you build with this! Let me know [on Twitter](https://twitter.com/signalnerve)!
88

9-
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/signalnerve/workers-graphql-server)
9+
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/workers-graphql-server)
1010

1111
## Usage
1212

1313
You can begin building your own Workers GraphQL server by [installing Wrangler](https://workers.cloudflare.com/docs/quickstart/), the Workers command-line tool, and generating a new project:
1414

15-
```
16-
wrangler generate my-graphql-server https://github.com/signalnerve/workers-graphql-server
15+
```sh
16+
wrangler generate my-graphql-server https://github.com/cloudflare/workers-graphql-server
1717
```
1818

1919
You'll need to configure your project's `wrangler.toml` file to prepare your project for deployment. See the ["Configuration"](https://developers.cloudflare.com/workers/cli-wrangler/configuration/) docs for a guide on how to do this. Note that you'll need to [find your Cloudflare API keys](https://developers.cloudflare.com/workers/cli-wrangler/authentication/) to set up your config file.
2020

21-
The source for this project includes an example external REST data source, and defined types for the [PokeAPI](https://pokeapi.co/), as an example of how to integrate external APIs.
21+
The source for this project includes an example external REST data source, and defined types for the [PokeAPI](https://pokeapi.co/), as an example of how to integrate external APIs. Once you have the worker available, try this query as a sanity check:
22+
23+
```graphql
24+
query samplePokeAPIquery {
25+
pokemon: pokemon(id:1) {
26+
id,
27+
name,
28+
height,
29+
weight,
30+
sprites{
31+
front_shiny,
32+
back_shiny
33+
}
34+
}
35+
}
36+
```
2237

2338
To start using the project, configure your `graphQLOptions` object in `src/index.js`:
2439

@@ -29,7 +44,7 @@ const graphQLOptions = {
2944
forwardUnmatchedRequestsToOrigin: false, // Boolean
3045
debug: false, // Boolean
3146
cors: true, // Boolean or Object to further configure
32-
kvCache: false // Boolean
47+
kvCache: false, // Boolean
3348
}
3449
```
3550

@@ -58,7 +73,7 @@ const graphQLOptions = {
5873
allowHeaders: 'Content-type',
5974
allowOrigin: '*',
6075
allowMethods: 'GET, POST, PUT',
61-
}
76+
},
6277
}
6378
```
6479

@@ -80,4 +95,4 @@ With a configured KV namespace set up, you can opt-in to KV caching by changing
8095

8196
## License
8297

83-
This project is licensed with the [MIT License](https://github.com/signalnerve/workers-graphql-server/blob/master/LICENSE).
98+
This project is licensed with the [MIT License](https://github.com/cloudflare/workers-graphql-server/blob/master/LICENSE).

cargo-generate.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[template]
2+
exclude = [".github"]

null.js

-1
This file was deleted.

0 commit comments

Comments
 (0)