docs: revise main docs outline (#10502)

This commit is contained in:
Shahed Nasser
2024-12-09 13:54:42 +02:00
committed by GitHub
parent c8cb9b5c1a
commit 0ae98c51eb
141 changed files with 814 additions and 1181 deletions
@@ -27,7 +27,7 @@ You create an API route in a `route.{ts,js}` file under a sub-directory of the `
<Note>
Learn more about API routes [in this guide](../../../basics/api-routes/page.mdx).
Learn more about API routes [in this guide](../../../fundamentals/api-routes/page.mdx).
</Note>
@@ -63,7 +63,7 @@ export const POST = async (
You export a route handler function with its name (`POST`) being the HTTP method of the API route you're exposing.
The function receives two parameters: a `MedusaRequest` object to access request details, and `MedusaResponse` object to return or manipulate the response. The `MedusaRequest` object's `scope` property is the [Medusa container](../../../basics/medusa-container/page.mdx) that holds framework tools and custom and core modules' services.
The function receives two parameters: a `MedusaRequest` object to access request details, and `MedusaResponse` object to return or manipulate the response. The `MedusaRequest` object's `scope` property is the [Medusa container](../../../fundamentals/medusa-container/page.mdx) that holds framework tools and custom and core modules' services.
<Note title="Tip">
@@ -85,7 +85,7 @@ Medusa uses [Zod](https://zod.dev/) to create validation schemas. These schemas
<Note>
Learn more about API route validation in [this chapter](../../../advanced-development/api-routes/validation/page.mdx).
Learn more about API route validation in [this chapter](../../../fundamentals/api-routes/validation/page.mdx).
</Note>
@@ -123,7 +123,7 @@ A middleware is a function executed before the route handler when a request is s
<Note>
Learn more about middlewares in [this chapter](../../../advanced-development/api-routes/middlewares/page.mdx).
Learn more about middlewares in [this chapter](../../../fundamentals/api-routes/middlewares/page.mdx).
</Note>
@@ -12,7 +12,7 @@ In a module, you create data models and business logic to manage them. In the ne
<Note>
Learn more about modules in [this chapter](../../../basics/modules/page.mdx).
Learn more about modules in [this chapter](../../../fundamentals/modules/page.mdx).
</Note>
@@ -30,7 +30,7 @@ A data model represents a table in the database. You create data models using Me
<Note>
Learn more about data models in [this chapter](../../../basics/modules/page.mdx#1-create-data-model).
Learn more about data models in [this chapter](../../../fundamentals/modules/page.mdx#1-create-data-model).
</Note>
@@ -56,7 +56,7 @@ You define the data model using the `define` method of the `model` utility impor
<Note title="Tip">
Learn about other property types in [this chapter](../../../advanced-development/data-models/property-types/page.mdx).
Learn about other property types in [this chapter](../../../fundamentals/data-models/property-types/page.mdx).
</Note>
@@ -70,7 +70,7 @@ In this step, you'll create the Brand Module's service that provides methods to
<Note>
Learn more about services in [this chapter](../../../basics/modules/page.mdx#2-create-service).
Learn more about services in [this chapter](../../../fundamentals/modules/page.mdx#2-create-service).
</Note>
@@ -168,7 +168,7 @@ A migration is a TypeScript or JavaScript file that defines database changes mad
<Note>
Learn more about migrations in [this chapter](../../../basics/modules/page.mdx#5-generate-migrations).
Learn more about migrations in [this chapter](../../../fundamentals/modules/page.mdx#5-generate-migrations).
</Note>
@@ -10,9 +10,9 @@ By following these guides, you'll add brands to the Medusa application that you
To build a custom feature in Medusa, you need three main tools:
- [Module](../../basics/modules/page.mdx): a package with commerce logic for a single domain. It defines new tables to add to the database, and a class of methods to manage these tables.
- [Workflow](../../basics/workflows/page.mdx): a tool to perform an operation comprising multiple steps with built-in rollback and retry mechanisms.
- [API route](../../basics/api-routes/page.mdx): a REST endpoint that exposes commerce features to clients, such as the admin dashboard or a storefront. The API route executes a workflow that implements the commerce feature using modules.
- [Module](../../fundamentals/modules/page.mdx): a package with commerce logic for a single domain. It defines new tables to add to the database, and a class of methods to manage these tables.
- [Workflow](../../fundamentals/workflows/page.mdx): a tool to perform an operation comprising multiple steps with built-in rollback and retry mechanisms.
- [API route](../../fundamentals/api-routes/page.mdx): a REST endpoint that exposes commerce features to clients, such as the admin dashboard or a storefront. The API route executes a workflow that implements the commerce feature using modules.
![Diagram showcasing the flow of a custom developed feature](https://res.cloudinary.com/dza7lstvk/image/upload/v1725867628/Medusa%20Book/custom-development_nofvp6.jpg)
@@ -14,7 +14,7 @@ The workflow you'll create in this chapter will use the Brand Module's service t
<Note>
Learn more about workflows in [this chapter](../../../basics/workflows/page.mdx).
Learn more about workflows in [this chapter](../../../fundamentals/workflows/page.mdx).
</Note>
@@ -67,7 +67,7 @@ You create a `createBrandStep` using the `createStep` function. It accepts the s
The step function receives two parameters: input passed to the step when it's invoked, and an object of general context and configurations. This object has a `container` property, which is the Medusa container.
The [Medusa container](../../../basics/medusa-container/page.mdx) is a registry of framework and commerce tools accessible in your customizations, such as a workflow's step. The Medusa application registers the services of core and custom modules in the container, allowing you to resolve and use them.
The [Medusa container](../../../fundamentals/medusa-container/page.mdx) is a registry of framework and commerce tools accessible in your customizations, such as a workflow's step. The Medusa application registers the services of core and custom modules in the container, allowing you to resolve and use them.
So, In the step function, you use the Medusa container to resolve the Brand Module's service and use its generated `createBrands` method, which accepts an object of brands to create.
@@ -85,7 +85,7 @@ You define for each step a compensation function that's executed when an error o
<Note>
Learn more about the compensation function in [this chapter](../../../advanced-development/workflows/compensation-function/page.mdx).
Learn more about the compensation function in [this chapter](../../../fundamentals/workflows/compensation-function/page.mdx).
</Note>