-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update graphql-yoga to latest v3 and follow
three
tag (#4560)
* Update graphql-yoga to latest v3 and follow `three` tag * Update yarn.lock * Use Yoga v3 also in the examples * Go * Go * Go * .. * chore(dependencies): updated changesets for modified dependencies Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d44bf60
commit d08ed0e
Showing
18 changed files
with
263 additions
and
225 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/http": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`graphql-yoga@3.0.0-next.0` ↗︎](https://www.npmjs.com/package/graphql-yoga/v/3.0.0-next.0) (from `3.0.0-alpha-20220917000718-4285245d`, in `dependencies`) |
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,5 @@ | ||
--- | ||
'@omnigraph/json-schema': patch | ||
--- | ||
|
||
Support non-native File or Blob instances |
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,5 +1,5 @@ | ||
require('./server') | ||
.start() | ||
.then(() => { | ||
console.info(`ResizeImage GraphQL API listening on 3002`); | ||
}); | ||
const startServer = require('./server'); | ||
|
||
startServer().then(() => { | ||
console.info(`ResizeImage GraphQL API listening on 3002`); | ||
}); |
56 changes: 34 additions & 22 deletions
56
examples/graphql-file-upload-example/resize-image/server.js
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,26 +1,38 @@ | ||
const { createServer } = require('@graphql-yoga/node'); | ||
const { createYoga, createSchema } = require('graphql-yoga'); | ||
const { createServer } = require('http'); | ||
const sharp = require('sharp'); | ||
|
||
module.exports = createServer({ | ||
schema: { | ||
typeDefs: /* GraphQL */ ` | ||
type Query { | ||
resizeImage(image: String, width: Int, height: Int): String | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
resizeImage: async (_, { image, width, height }) => { | ||
const inputBuffer = Buffer.from(image, 'base64'); | ||
const buffer = await sharp(inputBuffer).resize(width, height).toBuffer(); | ||
const base64 = buffer.toString('base64'); | ||
return base64; | ||
module.exports = function startServer() { | ||
const yoga = createYoga({ | ||
schema: createSchema({ | ||
typeDefs: /* GraphQL */ ` | ||
type Query { | ||
resizeImage(image: String, width: Int, height: Int): String | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
resizeImage: async (_, { image, width, height }) => { | ||
const inputBuffer = Buffer.from(image, 'base64'); | ||
const buffer = await sharp(inputBuffer).resize(width, height).toBuffer(); | ||
const base64 = buffer.toString('base64'); | ||
return base64; | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
maskedErrors: false, | ||
logging: false, | ||
hostname: 'localhost', | ||
port: 3002, | ||
}); | ||
}), | ||
maskedErrors: false, | ||
logging: false, | ||
}); | ||
const server = createServer(yoga); | ||
return new Promise(resolve => { | ||
server.listen(3002, () => { | ||
resolve( | ||
() => | ||
new Promise(resolve => { | ||
server.close(resolve); | ||
}) | ||
); | ||
}); | ||
}); | ||
}; |
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,5 +1,5 @@ | ||
require('./server') | ||
.start() | ||
.then(() => { | ||
console.info(`UploadFiles GraphQL API listening on 3001`); | ||
}); | ||
const startServer = require('./server'); | ||
|
||
startServer().then(() => { | ||
console.info(`UploadFiles GraphQL API listening on 3001`); | ||
}); |
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
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
Oops, something went wrong.