3.0.0

Options

Learn how to configure your Strapi SDK. 🖥

url

  • Type: string
  • Default: http://localhost:1337

The URL of the Strapi server.

prefix

  • Type: string
  • Default: /api

You have the capability to modify the API endpoint prefix. The default prefix is /api, allowing you to access your API at http://localhost:1337/api.

Check out the API configuration to learn how to change the default prefix.

store

  • Type: StoreConfig
    • key
      • Type: string
      • Default: strapi_jwt
    • useLocalStorage
      • Type: boolean
      • Default: false
    • cookieOptions
      • Type: object
      • Default: { path: "/" }

The store's configuration allows you to set the key for the cookie name, as well as the localStorage key if you choose to use it thanks the useLocalStorage boolean property. Additionally, you can provide cookieOptions to be passed to the js-cookie package.

import Strapi from "strapi-sdk-js"

const strapi = new Strapi({
  store: {
    key: "strapi_jwt",
    useLocalStorage: false,
    cookieOptions: { path: "/" },
  },
})

axiosOptions

  • Type: AxiosRequestConfig
  • Default: {}

Options to be passed to the Axios instance.