Files
sveltekit-og/examples/netlify-build/src/routes/cog/+server.ts
Shivam Meena d4663f8123 v3 initialized
2023-12-13 22:39:41 +05:30

26 lines
607 B
TypeScript

import OG from './OG.svelte';
import type { RequestHandler } from '@sveltejs/kit';
import { ImageResponse } from '@ethercorps/sveltekit-og';
export const GET: RequestHandler = async ({fetch}) => {
const fontFile = await fetch('https://og-playground.vercel.app/inter-latin-ext-700-normal.woff');
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
return new ImageResponse(
OG,
{
height: 250,
width: 500,
fonts: [
{
name: 'Inter Latin',
data: fontData,
weight: 700
}
]
},
{ text: 'Ready to dive in?', spanText: 'Start your free trial today.' }
);
};