Migration Guide

If you're upgrading from the previous Wix CLI version, this guide helps you migrate your existing HTTP functions to the new Astro endpoints format. The main changes involve updating your file structure and syntax.

Backend migration steps

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

  1. Relocate HTTP function files from src/backend/api/<name>/api.ts to src/pages/api/<name>.ts.

  2. Add the APIRoute type import:

    Copy
  3. Change method signatures from:

    Copy

    To:

    Copy

Frontend migration steps

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 used in the previous CLI version, with files located in the src/backend/api/ directory.

Copy

Updated syntax

This example shows the new Astro endpoints syntax used in the new CLI version, with files located in the src/pages/api/ directory.

Copy
Did this help?