-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(deps): update dependency vite to v3 (master) (#1444) * chore(deps): update actions/checkout action to v3 (#1431) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency ioredis to v5.2.2 (#1450) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Replace cross-undici-fetch with @whatwg-node/fetch * chore(deps): update dependency vite to v3 * Fix GraphiQL build * Go Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Arda TANRIKULU <[email protected]> * Check Endpoint Plugin * Fix for new v3 API * Update docs * .. * Add an ugly 404 page * Bump whatwg-node/server to make Express happy * Fix CF E2E * Fix AWS * Fix tests * Go * Go Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f64f21f
commit 94db79d
Showing
19 changed files
with
252 additions
and
73 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
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,5 +1,10 @@ | ||
import { createYoga } from 'graphql-yoga' | ||
|
||
const yoga = createYoga() | ||
// We can define GraphQL Route dynamically using env vars. | ||
declare var GRAPHQL_ROUTE: string | ||
|
||
const yoga = createYoga({ | ||
graphqlEndpoint: GRAPHQL_ROUTE || '/graphql', | ||
}) | ||
|
||
self.addEventListener('fetch', yoga) |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Plugin } from './types' | ||
|
||
export function useCheckEndpoint(graphqlEndpoint: string): Plugin { | ||
return { | ||
onRequest({ request, fetchAPI, endResponse }) { | ||
// new URL is slow | ||
const { pathname: requestPath } = new URL(request.url) | ||
if (requestPath !== graphqlEndpoint) { | ||
const errorMessage = ` | ||
<html> | ||
<head> | ||
<title>GraphQL Yoga - 404 Not Found</title> | ||
<style> | ||
body { | ||
font-family: monospace; | ||
font-size: 12px; | ||
margin: 10px auto; | ||
text-align: center; | ||
} | ||
code { | ||
background: #d5d5d5; | ||
color: brown; | ||
} | ||
textarea { | ||
width: 450px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>Unable to <code>${request.method}</code> <code>${requestPath}</code> | ||
<hr> | ||
<p>GraphQL Endpoint is set to <code>${graphqlEndpoint}</code> now.<p> | ||
<p> | ||
So if you expect it to be <code>${requestPath}</code> | ||
please add <code>graphqlEndpoint: '${requestPath}'</code> to GraphQL Yoga configuration like below; | ||
</p> | ||
<textarea readonly rows="10"> | ||
import { createYoga } from 'graphql-yoga'; | ||
import { schema } from './schema.js'; | ||
const yoga = createYoga({ | ||
schema, | ||
graphqlEndpoint: '${requestPath}', | ||
}) | ||
</textarea> | ||
</body> | ||
</html> | ||
` | ||
endResponse( | ||
new fetchAPI.Response(errorMessage, { | ||
status: 404, | ||
statusText: 'Not Found', | ||
headers: { | ||
'Content-Type': 'text/html', | ||
}, | ||
}), | ||
) | ||
} | ||
}, | ||
} | ||
} |
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.