Configuring action factory
What you'll learn
- Configuring your action factory dependencies
You may need to configure your action factory implementation and dependencies to match your data source needs.
You can customize the dependencies when using a blueprint action factory or when using a custom action factory.
In this guide, we will see how to customize dependencies configuration through
the REST blueprint action factory as an example. For this, each configurable
dependency have a configure
method which will allow you to configure the
dependency.
action.js
import { makeJsonRest } from 'foscia/blueprints';
import Post from './models/post';
const { cache, registry, adapter, deserializer, serializer, action } =
makeJsonRest({
baseURL: 'https://example.com/api/v1',
});
registry.register(Post);
// Configure the dependencies you want:
cache.configure({
/* Cache configuration. */
});
adapter.configure({
/* Adapter configuration. */
});
deserializer.configure({
/* Deserializer configuration. */
});
serializer.configure({
/* Serializer configuration. */
});
export default action;
info
To know which configuration options are available in a configuration
method,
you should check out the method signature or
the dedicated implementations guides.