Skip to content

Commit

Permalink
Test again
Browse files Browse the repository at this point in the history
  • Loading branch information
ploca14 committed Nov 24, 2023
1 parent c697600 commit 2074c89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
14 changes: 6 additions & 8 deletions app/server/api/hello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import type { Database } from "../../types/database";

export default defineEventHandler(async (event) => {
const client = await serverSupabaseClient<Database>(event);

// Generate a random id, it has to be an integer
const { data, error } = await client
console.log("starting");
await new Promise((resolve) => setTimeout(resolve, 10000));
console.log("progress");
await new Promise((resolve) => setTimeout(resolve, 25000));
console.log("done");
await client
.from("documents")
.insert({ id: Math.floor(Math.random() * 1000000), content: "test" });

return {
data,
error,
};
});
12 changes: 1 addition & 11 deletions app/server/api/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@ import type { Database } from "../../types/database";
export default defineEventHandler((event) => {
setResponseStatus(event, 202);

(async () => {
const client = await serverSupabaseClient<Database>(event);
console.log("starting");
await new Promise((resolve) => setTimeout(resolve, 10000));
console.log("progress");
await new Promise((resolve) => setTimeout(resolve, 25000));
console.log("done");
await client
.from("documents")
.insert({ id: Math.floor(Math.random() * 1000000), content: "test" });
})();
$fetch("/api/hello");
});

0 comments on commit 2074c89

Please sign in to comment.