Skip to content

Conversation

pwizla
Copy link
Collaborator

@pwizla pwizla commented Oct 15, 2021

What does it do?

Adds a contextual introduction for Backend customization.
Will be used as a landing page (if needed for SEO/redirections).

Note: The various concepts (routes, controllers, policies, middlewares…), now split in separate files, will be updated in upcoming PRs.

@vercel
Copy link

vercel bot commented Oct 15, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/strapijs/documentation/3WDGbAjasL1g2w8BQi2ocm77kuss
✅ Preview: https://documentation-git-dev-v4-backend-customizations-intro-strapijs.vercel.app

@pwizla pwizla self-assigned this Oct 15, 2021
@pwizla pwizla added source: Dev Docs PRs/issues targeting the Developer Docs target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch). internal PRs created by the Strapi core team pr: new content PRs for new product features or new documentation sections labels Oct 18, 2021

## Requests

As Strapi runs an HTTP server, it receives requests, handled by [routes](#routes). These requests can come from API calls (e.g. via a client application) or from the Strapi's admin panel and plugins.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this more explicit, i.e it receives requests that are forwarded to the controllers that handle them by the routes. or is that not necessary in this context?

Suggested change
As Strapi runs an HTTP server, it receives requests, handled by [routes](#routes). These requests can come from API calls (e.g. via a client application) or from the Strapi's admin panel and plugins.
As Strapi runs an HTTP server, it receives requests, handled by [routes](#routes). These requests can come from API calls (e.g. via a client application) or from the Strapi's admin panel and plugins.


- the request itself is accessible through `ctx.request` and is available to [controllers](#controllers) and [policies](#policies),
- the body of the request is passed as `ctx.request.body`,
- and the files are passed as `ctx.request.files`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should expand this to include some of our custom objects here like ctx.request.route


## Routes

Requests can be handled on any URL by adding [routes](/developer-docs/latest/development/backend-customization/routes.md) to Strapi. Using routes is the first step towards creating custom JSON APIs to be used later on in the client application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Requests can be handled on any URL by adding [routes](/developer-docs/latest/development/backend-customization/routes.md) to Strapi. Using routes is the first step towards creating custom JSON APIs to be used later on in the client application.
Requests can be handled on any URL by adding [routes](/developer-docs/latest/development/backend-customization/routes.md) to Strapi. Using routes is the first step towards creating custom REST APIs to be used later on in the client application.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounded weird, indeed, but it was actually written like this ('JSON') by @alexandrebodin in the document he sent me. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it was okay in order to create the distinction, "JSON APIs" for both REST and GraphQL? 🤔


As a developer, you can manually add policies, and they can also be added by the admin panel or by plugins.

## Middlewares
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably specify there are global middlewares (ran on every request) or route middlewares (which are only ran when the specific route is called).

In v3 we only had global middlewares and v3 policies functioned as route middlewares but that's changed with the new policy system in v4

Co-authored-by: DMehaffy <derrickmehaffy@gmail.com>
@pwizla pwizla mentioned this pull request Oct 21, 2021
1 task
@pwizla pwizla changed the base branch from next to dev/next-3 October 22, 2021 07:23
@pwizla
Copy link
Collaborator Author

pwizla commented Oct 22, 2021

Thank you for your very valuable feedback, everyone!

I'm closing this PR as, after discussing its content and structure with Mégane, we will do it another way:

  • explanations for each section will be reused in the introduction of the dedicated files (routes, policies, controllers, etc.)
  • I will create another PR with a shorter intro to backend customization that will act even more as a TOC page

@pwizla pwizla closed this Oct 22, 2021
@pwizla pwizla deleted the dev/v4-backend-customizations-intro branch March 21, 2022 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal PRs created by the Strapi core team pr: new content PRs for new product features or new documentation sections source: Dev Docs PRs/issues targeting the Developer Docs target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants