import { Hono } from "hono";
import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";
const app = new Hono().get("/", async (c) => {
console.log("running accounts query");
const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error
};
return c.json({ data });
});
export default app;
import { Hono } from "hono";
import { db } from "@/db/drizzle";
import { accounts } from "@/db/schema";
const app = new Hono().get("/", async (c) => {
console.log("running accounts query");
const data = async () => {
try {
const dbFetch = await db
.select({
id: accounts.id,
name: accounts.name,
})
.from(accounts);
return dbFetch;
} catch (error) {
console.log("Error fetching data from DB", error);
}
// when I comment out the data function and replace what's being passed to c.json() with something fixed then there is no issue but when I just try to run this function even when its not being passed to c.json() then it throws the same error
};
return c.json({ data });
});
export default app;