Zum Inhalt springen
#0272
Exec

Your static site's API is a folder of .ts files

Your Astro site needs a contact form and a newsletter signup. You don't want a serverless account, a build step, or a CORS lecture.

You drop contact.ts and subscribe.ts into the exec instance's api/ folder. They're live at /api/contact and /api/subscribe the moment they're saved. TypeScript transpiles on its own. The fetch from your static page works the first time because the exec service mirrors the request origin by default; when you ship, one @cors https://yoursite.com comment pins it.

Add [id].ts for a dynamic route. Add pre.ts for a rate limit or auth check that wraps everything beside it. Nothing to redeploy, nothing to configure.

The backend is a folder, and the folder is already deployed.