Skip to content

Commit

Permalink
Update docs/guides/tutorials/cloudflare_workers.rst
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Trinh <[email protected]>
  • Loading branch information
beerose and scotttrinh authored Feb 13, 2024
1 parent 94fc392 commit eacb954
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions docs/guides/tutorials/cloudflare_workers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,28 +142,25 @@ To interact with your **local EdgeDB instance**, use the following code:

.. code-block:: typescript
import * as edgedb from 'edgedb';
import * as edgedb from "edgedb";
export default {
async fetch(
_request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
const client = edgedb.createHttpClient({
tlsSecurity: 'insecure',
dsn: '<your-edgedb-dsn>',
});
const movies = await client.query(`select Movie { title }`);
return new Response(JSON.stringify(movies, null, 2), {
headers: {
'content-type': 'application/json;charset=UTF-8',
},
});
},
async fetch(
_request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
const client = edgedb.createHttpClient({
tlsSecurity: "insecure",
dsn: "<your-edgedb-dsn>",
});
const movies = await client.query(`select Movie { title }`);
return new Response(JSON.stringify(movies, null, 2), {
headers: {
"content-type": "application/json;charset=UTF-8",
},
});
},
} satisfies ExportedHandler<Env>;
Expand Down

0 comments on commit eacb954

Please sign in to comment.