/**
 * Implements hook_rest_type_uri_alter().
 */
function {{ machine_name }}_rest_type_uri_alter(&$uri, $context = []) {
  if ($context['mymodule'] == TRUE) {
    $base = \Drupal::config('serialization.settings')->get('link_domain');
    $uri = str_replace($base, 'http://mymodule.domain', $uri);
  }
}
