0

我正在尝试将 ngrx/data 与我的 api 一起使用。我的 api 以 /resources 格式公开所有请求的资源,而不是 POST /resource(不带“s”)。对于 GET /resources/:id 而不是 /resource/:id 与ngrx/data 的要求相同。

如何强制数据服务为所有请求命中 /resources?谢谢

4

1 回答 1

1

您可以使用包含以下内容的 entity-metadata.ts 文件:

const entityMetadata: EntityMetadataMap = {
  ressources: {}
};

const pluralNames = {
  ressources: 'ressources'
};

export const entityConfig = {
  entityMetadata,
  pluralNames,
};

在您的模块中,您需要一个导入:

EntityDataModule.forRoot(entityConfig)
于 2021-08-27T10:16:51.093 回答