Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const graphqlHandler = async (req: Request): Promise => {
const url = new URL(req.url);
const query =
req.method === 'POST'
? await req.json()
: {
query: url.searchParams.get('query'),
variables: url.searchParams.get('variables'),
operationName: url.searchParams.get('operationName'),
extensions: url.searchParams.get('extensions'),
};
return runHttpQuery([req], {
method: req.method,
options: options,
query,
request: req as Request,
}).then(