NeonN
Neon2y ago
10 replies
progressive-amaranth

not able to fetch and mutate the data

Hi all,
I am trying to use this code
export default async function Page(formData: FormData) {
  try {
    const sql = postgres(process.env.DATABASE_URL ?? "", { ssl: 'require' });
    await sql`CREATE TABLE IF NOT EXISTS comments (comment TEXT)`;
    const comment = String(formData.get("data")); // Convert comment to a string
    await sql`INSERT INTO comments (comment) VALUES (${comment})`;
    console.log("Comment added")}
 catch (error) {
    console.log(error)}}

which is given in the official docs but I can't see any entry or any console-logged data in my terminal.

https://github.com/Boby900/yogurt
any help would be highly appreciated
Screenshot_481.png
Screenshot_480.png
GitHub
Contribute to Boby900/yogurt development by creating an account on GitHub.
GitHub - Boby900/yogurt
Was this page helpful?