Back to marketplace
Open preview in a new tab
Utilities

homepage
A public TypeScript function.
Live Preview
Loading preview…
Source Preview
typescript
import fn from "@hostfunc/sdk";
interface EmailPayload {
from: string,
to: string,
subject?: string, // omitted if blank
body?: string, // trimmed plain-text body, omitted if blank
timestamp: string, // ISO
rawSize: number,
}
export async function email(payload: { email: EmailPayload }) {
const { from, to, subject, body, timestamp } = payload.email;
console.log(`📧 from ${from} — "${subject ?? "(no subject)"}"`);
// ...do whatever: store, parse, forward, kick off work...
return { ok: true, handled: subject ?? null };
}
// The index.html asset attached to this function is served as a live web
// page at its public URL. main() handles API / non-HTML requests.
export async function main(input: { format?: string }) {
fn.log("info", "html-page.api", { format: input.format ?? "json" });
return {
page: "index.html",
message: "Edit index.html in the file tree — the preview updates live.",
renderedAt: new Date().toISOString(),
};
}
About
No README has been published for this function yet.
Discussion
0Join the discussion
Sign in to comment, reply, and star functions you love.
Start the conversation.
Share a use case, ask a question, or suggest an improvement. Be the first to comment on this function.