0

I'm trying to use ngrx/data with my api. My api exposes resources under the format /resources for all requests instead of POST /resource (without 's'). Same for GET /resources/:id instead of /resource/:id as required by ngrx/data.

How can I force the data service to hit /resources for all requests? Thanks

user1445685
  • 793
  • 1
  • 11
  • 25

1 Answers1

1

You might use an entity-metadata.ts files with following content:

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

const pluralNames = {
  ressources: 'ressources'
};

export const entityConfig = {
  entityMetadata,
  pluralNames,
};

In your module you need an import with:

EntityDataModule.forRoot(entityConfig)
  • It is also possible to provide a custom HttpUrlGenerator as written in the docs: https://ngrx.io/guide/data/extension-points#replace-the-httpurlgenerator – Butterblume Oct 06 '21 at 12:55