brain
brain
CDCloudflare Developers
Created by brain on 8/1/2024 in #pages-help
Cloudflare Pages Error
@Walshy | Deploying seemed to be a dependency error. already fixed 🙂
5 replies
CDCloudflare Developers
Created by brain on 8/1/2024 in #pages-help
Cloudflare Pages Error
Also, it's a simple React/Vite SPA. No next.js or any SSR
5 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
good luck with work
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
yes, of course!
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
No description
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
No description
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
No description
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
please keep me posted! still seeing the same
33 replies
CDCloudflare Developers
Created by elliott on 7/6/2024 in #hyperdrive
Pgjs perf investigation
here's the code, for reference:
base.get("/user/:id", async (c) => {
const database = db(c.env.HYPERDRIVE);
const userId = c.req.param("id");
const startTime = new Date();
const user = await database
.select({
id: users.id,
email: users.email,
createdAt: users.createdAt,
})
.from(users)
.where(eq(users.id, userId))
.execute();
const executeTime = new Date();
console.log("Execute time", executeTime.getTime() - startTime.getTime());

if (!user) {
return c.json({ error: "User not found" }, 404);
}

return c.json(user);
});
base.get("/user/:id", async (c) => {
const database = db(c.env.HYPERDRIVE);
const userId = c.req.param("id");
const startTime = new Date();
const user = await database
.select({
id: users.id,
email: users.email,
createdAt: users.createdAt,
})
.from(users)
.where(eq(users.id, userId))
.execute();
const executeTime = new Date();
console.log("Execute time", executeTime.getTime() - startTime.getTime());

if (!user) {
return c.json({ error: "User not found" }, 404);
}

return c.json(user);
});
---
import postgres from "postgres";
import { drizzle } from "drizzle-orm/postgres-js";

export const db = (hd: Hyperdrive) => {
const sql = postgres(hd.connectionString, {
prepare: true, // or false
});
return drizzle(sql);
};
import postgres from "postgres";
import { drizzle } from "drizzle-orm/postgres-js";

export const db = (hd: Hyperdrive) => {
const sql = postgres(hd.connectionString, {
prepare: true, // or false
});
return drizzle(sql);
};
33 replies