Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 2.04 KB

MIGRATION.md

File metadata and controls

40 lines (33 loc) · 2.04 KB

Azure Functions Migration Notes

Action handlers are deliberately close to Azure Functions v4. This template is not Azure Functions, but the handler shape, context.log, context.invocationId, and httpResponse({...}) names are chosen so moving later is mostly mechanical.

// Here:
defineAction({
    name: "syncCustomers",
    methods: ["POST"],
    handler: async (request, context) => {
        context.log("starting sync");
        return httpResponse({ status: 201, jsonBody: { count: 42 } });
    },
});

// Azure Functions v4:
app.http("syncCustomers", {
    methods: ["POST"],
    authLevel: "function",
    handler: async (request, context) => {
        context.log("starting sync");
        return { status: 201, jsonBody: { count: 42 } };
    },
});

Main differences:

  • Request body here is sync: request.body, already parsed by Express.
  • Azure Functions v4 uses async body helpers such as await request.json().
  • Cron should use 6-field NCRONTAB if you expect to port schedules to Timer triggers.

Useful Azure Functions docs: