index.php Is Back Coding Joke
index.php is BACK Gerardo @acidbjazz · 2d what black magic is this? @vercel ❤️ app/page.tsx 1 import { sql } from '@vercel/postgres'; 2 import { redirect } from 'next/navigation'; 4 async function create(formData: FormData) { 5 'use server'; 6 const { rows } = await sql` 7 INSERT INTO products (name) 8 VALUES (${formData.get('name')}) 9 `; 10 redirect(`/product/${rows[0].slug}`); 11 } 13 export default function Page() { 14 return ( 15 <form action={create}> 16 <input type="text" name="name" /> 17 <button type="submit">Submit</button> 18 </form> 19 ); 20 }
A dark-mode social media post praises Vercel’s “black magic” while displaying a Next.js page component that uses a server action to insert a product into PostgreSQL and redirect to its new URL. The joke is that modern framework features make database writes and redirects look surprisingly simple, as if ordinary PHP has returned in a more magical form. It is shared as a reaction to impressive, clever, or overly magical web development code. EN: A dark-mode social media post praises Vercel’s “black magic” while displaying a Next.js page component that uses a server action to insert a product into PostgreSQL and redirect to its new URL. The joke is that modern framework features make database writes and redirects look surprisingly simple, as if ordinary PHP has returned in a more magical form. It is shared as a reaction to impressive, clever, or overly magical web development code.
- @gentoomemes / 4385 2023-05-04
- @rzeczyzabawne / 8754 2023-05-05
- Type
- image
- Size
- 622×800 · 60.7 KiB
- Mood
- amused, impressed
- Language
- en
- Added