Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Networking

Darko Kukovec edited this page Jan 11, 2018 · 3 revisions

Setting up basic options

To use the network layer, you should check/update the following options:

  • Store baseUrl - The base path to the API. Default is "/", but could be something like "https://example.com/api/"
  • Record endpoint - Path to the model type on the API. If not defined, it will use the model type. This can be used if the url needs to be prefixed (e.g. model scoping) or e.g. if the url is in plural, but the model type is in singular
  • fetchReference - Set to window.fetch by default, but can be set to some other fetch implementation, e.g. isomorphic-fetch
  • defaultHeaders - Headers that will be sent with every request. By default, it is setting the content-type header according to the JSON API specification

If you want to use some other method of communication with the server (e.g. jQuery, superagent or axios), you can override the baseFetch method.

If you need to set some custom headers which depend on the data in the store, you can override the storeFetch method.


For a detailed specification of the available options, check out the config options.

Clone this wiki locally