Migrate from HTTP Functions to HTTP Endpoints

This guide explains how to migrate HTTP functions to HTTP endpoints in your new Wix CLI project, as part of migrating an app from the legacy Wix CLI. The main changes involve updating your file structure and syntax.

Step 1 | Migrate the backend

To migrate your HTTP functions to HTTP endpoints, first update your backend code:

  1. From your legacy project, copy src/backend/api/<name>/api.ts to src/pages/api/<name>.ts in your new Wix CLI project.

  2. Add the APIRoute type import:

    Copy
  3. Change method signatures from:

    Copy

    To:

    Copy

Step 2 | Migrate the frontend

After updating your backend code, update your frontend code to call the new endpoints:

Change from:

Copy

To:

Copy

Backend example

Previous syntax

This example shows the old HTTP functions syntax from your legacy project, with files located in the src/backend/api/ directory.

Copy

Updated syntax

This example shows the new HTTP endpoints syntax in your new Wix CLI project, with files located in the src/pages/api/ directory.

Copy

Last updated: 29 June 2026

Did this help?