Search.../

Introduction

To make a request, call the fetch() function with the path to a resource and the optional WixFetchRequest options. The function returns a promise that resolves to a WixFetchResponse. The response object contains a number of properties and functions for retrieving the response's information.

The Fetch API can be used in your front-end or backend code.

To use the Fetch API in the backend, import the fetch function from the wix-fetch module:

import {fetch} from 'wix-fetch';
javascript | Copy Code

The implementation of the Fetch API differs slightly depending on where it's being used. The features documented here comprise the base functionality for both implementations. However, each implementation contains additional features:

  • In public files, the native browser's Fetch API is used.
  • In backend files the node-fetch module is used.

Was this helpful?