benim adım kamil
furkan
if ( Astro.request.method === "POST" ) {
const formData = await Astro.request.formData();
const data = {
title: String(formData.get('title')),
slug: String(formData.get('slug')),
content: await marked(String(formData.get('content'))),
excerpt: String(formData.get('excerpt')),
}
const results = await databases.createDocument(
import.meta.env.PUBLIC_APPWRITE_DATABASE_ID,
import.meta.env.PUBLIC_APPWRITE_COLLECTION_ID,
ID.unique(),
data
);
return Astro.redirect(/posts/${results.slug}
);
}
---