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

Improving routes page #2097

Merged
merged 16 commits into from
May 2, 2024
Merged

Improving routes page #2097

merged 16 commits into from
May 2, 2024

Conversation

lcpichette
Copy link
Contributor

@lcpichette lcpichette commented May 1, 2024

What does it do?

Updated the handler names in the Configuration section and added a reference to a strapi command that allows you to view all existing routes and their current hierarchal order in the top-level/introductory section (above Implementation).

Why is it needed?

I was told in office hours that the existing handler name I had was incorrect, but it matched the docs. I was then suggested to use the following format api::whatever.whatever.yourFunction.

Knowing what the api::whatever.whatever part is can be kind of confusing -- when do I use singular/plural for my collection-types? Do I use my file name or the collection name? I was told of a really helpful command to see if my routes exist -- and what they're labeled as (e.g. api::whatever.whatever): yarn strapi routes:list

Related issue(s)/PR(s)

It is something I discovered was an issue during office hours.

@lcpichette lcpichette requested a review from pwizla as a code owner May 1, 2024 18:34
Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
documentation 🛑 Canceled (Inspect) May 2, 2024 8:54am

@strapi-cla
Copy link

strapi-cla commented May 1, 2024

CLA assistant check
All committers have signed the CLA.

@pwizla
Copy link
Collaborator

pwizla commented May 2, 2024

Thanks for the contribution, @lcpichette!

Regarding your question about using singular/plural, I'd say it all depends on how you called your content-type and controller 😅 The name/path of the file is what is important.

If you used singular (for instance when you create the content-type either with the Content-Type Builder or with the strapi generate interactive CLI), it will be singular.
This is for instance the case for the restaurant content-type created throughout our docs, and also used in the examples/getstarted code in the strapi/strapi repo:
Screenshot 2024-05-02 at 10 17 09

You can also have a look at my screenshot, as a test I created a "livre" (singular) content-type and the code is using "livre":

Screenshot 2024-05-02 at 10 21 50

If, for some specific reasons, your "default" name is already plural (which I won't recommend), like creating a "tables" content-type, the uid will use this plural version:
Screenshot 2024-05-02 at 10 30 10

Oh, and we opted for a "generic" controllerName naming because it actually depends on whether you use an API controller or a plugin controller. See usage here.

FYI the strapi routes:list is mentioned in the CLI reference guide: https://docs.strapi.io/dev-docs/cli#strapi-routeslist. You can also use other list-type commands.

I understand this might all be a bit confusing and there are lots of pieces working together and customization possibilities. Your PR will be helpful (and I'll slightly tweak it to include the plugin use case).

@pwizla pwizla self-assigned this May 2, 2024
@pwizla
Copy link
Collaborator

pwizla commented May 2, 2024

The PR is now approved, merged, should be live on docs.strapi.io in a few minutes, and will be mentioned in the next weekly snapshot release.

@pwizla pwizla added source: Dev Docs PRs/issues targeting the Developer Docs pr: fix Used on the docs repo for anything that is not "new" or "updated" content: chore, typos, fixes, etc. labels May 2, 2024
@pwizla pwizla added this to the 4.24.1 milestone May 2, 2024
@pwizla pwizla merged commit f16f32f into strapi:main May 2, 2024
2 of 3 checks passed
@pwizla pwizla added the temp: port to v5 Temporary label for PRs that need to be ported to v5 docs label May 2, 2024
@pwizla pwizla changed the title pr: chore - Improving routes page Improving routes page May 2, 2024
MbonuJennifer added a commit that referenced this pull request May 22, 2024
@MbonuJennifer MbonuJennifer removed the temp: port to v5 Temporary label for PRs that need to be ported to v5 docs label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Used on the docs repo for anything that is not "new" or "updated" content: chore, typos, fixes, etc. source: Dev Docs PRs/issues targeting the Developer Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants