Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 18 lines 573 B view raw
1import { Status } from "@hey/data/enums"; 2import type { Context } from "hono"; 3import { CACHE_AGE_1_DAY } from "@/utils/constants"; 4import handleApiError from "@/utils/handleApiError"; 5import getMetadata from "./helpers/getMetadata"; 6 7const getOembed = async (ctx: Context) => { 8 try { 9 const { url } = ctx.req.query(); 10 ctx.header("Cache-Control", CACHE_AGE_1_DAY); 11 const oembed = await getMetadata(url); 12 return ctx.json({ data: oembed, status: Status.Success }); 13 } catch (error) { 14 return handleApiError(ctx, error); 15 } 16}; 17 18export default getOembed;