Skip to Content
FunctionsTest and Publish a MiniUp Function
On this page

Test and Publish a MiniUp Function

The Function editor separates your draft from the live endpoint. Save draft preserves work, Test runs a preview of the draft, and Publish makes the code live.

Create and test a Function

  1. Open Functions → New Function. Enter a Display name and Stable slug, then select Create.
  2. Open Code and replace the starter with a handler like the example below.
  3. Save the draft. Saving alone does not change production.
  4. Open Test, set the method to GET and the path to /health, and run the preview. Headers must be a JSON object; request bodies must match what your handler expects.
  5. Inspect the response status and body. Fix any error and repeat Test.
  6. Set the intended access and allowed methods in API. Add any required Function Secrets.
  7. Select Publish, wait for the live confirmation, and copy the Function endpoint.

Minimal Function handler

export default { async fetch(request, env) { const url = new URL(request.url); if (request.method === "GET" && url.pathname.endsWith("/health")) { return Response.json({ ok: true, service: "my-api" }); } return Response.json({ error: "Not found" }, { status: 404 }); } };

For a standalone Function, append /health to the endpoint copied from MiniUp. For a Site Members Function, call /api/functions/my-api/health from the linked Site as an authorized member.

Understand Test, Preview, and Publish

Test runs the current saved draft in a preview and does not replace live code. A passing preview proves only the request tested: verify the published endpoint, its access requirements, and any external service calls too. Preview code may still call external services, so use test data for operations with side effects.

Trusted ESM imports are resolved during Test/Preview and Publish. Secret additions, updates, and removals require another Publish before the live Function uses the current Secret set.

Change settings or endpoint status

In Settings, change the display name or description. The slug locks after the first deployment. Use Disable endpoint to make the endpoint unavailable while retaining deployed code, then Enable endpoint to restore that deployed code. Delete Function is permanent; review the confirmation carefully.

The editor shows draft changes and last-deployed status. It does not currently expose a revision rollback browser. To restore older Function logic, paste your saved copy, test it, and publish again.

create Function · draft · code · Test · Preview · Publish · disable · enable · delete · revisions