# Using adapters

Adapters allow you to transform requests before sending them to Algolia and normalize the responses from Algolia before sending them to the client. You can add AgnosticResponse (opens new window) fields to the response to make it work with the searchGetters.

You can also create an adapter to DRY (opens new window) theme's templates.

# Registering an adapter

In order to register an adapter, you have to add it to the algolia.configuration.adapters array in middleware.config.js.

# Built-in adapters

WARNING

Remember to always check if adapter requires additional fields in the configuration to work properly.

// middleware.config.js
algolia: {
  location: '@vsf-enterprise/algolia-api/server',
  configuration: {
    // ...
    adapters: [
      'commercetools',
      'contentstack'
    ]
  }
}

# Creating custom adapter

// middleware.config.js
algolia: {
  location: '@vsf-enterprise/algolia-api/server',
  configuration: {
    // ...
    adapters: [
      (settings) => {
        // AdapterFactory function
      }
    ]
  }
}

For more information, please see the Creating custom adapter page.