Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Introducing Vercel Postgres - Vercel

Vercel News·Elijah Cobb·3 days ago
#pBuOgpxP
#vercel#postgres#name#formdata#import#photo
Reading 0:00
15s threshold

Vercel Postgres is a serverless PostgresSQL database, designed to integrate with Vercel Functions and any frontend framework.

import { sql } from '@vercel/postgres';

import { redirect } from 'next/navigation';

async function create(formData: FormData) {

'use server';

const { rows } = await sql`

INSERT INTO products (name)

VALUES (${formData.get('name')})

`;

redirect(`/product/${rows[0].slug}`);

}

export default function Page() {

return (

<form action={create}>

<input type="text" name="name" />

<button type="submit">Submit</button>

</form>

);

}

Use Vercel Postgres with Next.js Server Actions (to be announced Thursday)

Vercel Postgres is available for Hobby and Pro users during the public beta.

Check out our documentation or get started with a template:

Read More