Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ngrx/data: how to configure the use of plural resource names for all http requests #2406

Closed
rryter opened this issue Feb 23, 2020 · 3 comments

Comments

@rryter
Copy link
Contributor

rryter commented Feb 23, 2020

By convention, an HTTP request targeting a single entity item contains the lowercase, singular version of the entity type name. For example, if the entity type entityName is "Hero", the default data service will POST to a URL such as 'api/hero'.

Our rest api was designed to always use the plural name for the resource(s). How can I configure @ngrx/data to always use the plural resource name for any http requests? I feel like I'm probably missing the obvious.

I would be willing to submit a PR for the docs ❤️

[x ] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No

@timdeschryver
Copy link
Member

I think we go through this in our docs.
If this doesn't provide enough information, please feel free to re-open the issue.

@LMFinney
Copy link
Contributor

Thanks for the example. I'm glad there's an example in the docs.

Two notes:

  1. There are a couple compilation issues with the example (pluralizer is misspelled as pluralizzer once, and the private pluralizer can't override the parent's private pluralizer). I just submitted docs(data): fix compilation errors in example #2490 to fix these.
  2. It would be nice if this were a simple config option, like the pluralNames property. Would it be possible to add that?

@thardy
Copy link

thardy commented Jul 16, 2020

I recently got hit in the face with this one. This design decision is baffling to me. RESTful resources should all share the same convention...
GET products
GET products/1
PUT products/1
POST products
DELETE products/1

I've never seen any RESTful resource alter the pluralization within a single resource. Why did you guys decide to make people jump through hoops for following web standards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants