docs: add routing page (#9550)

- Add a new homepage to `book` project for the routing page
- Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs)
- Other: add admin components to resources dropdown + fixes to search on mobile.

Closes DX-955

Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
This commit is contained in:
Shahed Nasser
2024-10-18 08:24:34 +00:00
committed by GitHub
parent 7a47f5211d
commit 0a37675f0e
223 changed files with 2549 additions and 696 deletions
@@ -0,0 +1,63 @@
export const metadata = {
title: `${pageNumber} Your First Customizations`,
}
# {metadata.title}
In this chapter, youll build your first customizations with Medusa.
## 1. Create API Route
API Routes expose business logic through REST APIs. You can create custom API routes to expose custom business logic.
To create an API route, create the file `src/api/hello-world/route.ts` with the following content:
```ts title="src/api/hello-world/route.ts"
import type {
MedusaRequest,
MedusaResponse,
} from "@medusajs/framework/http"
export const GET = (
req: MedusaRequest,
res: MedusaResponse
) => {
res.json({
message: "Hello, world!",
})
}
```
---
## 2. Test Customizations
To test out your customizations:
1. Start the Medusa application:
```bash npm2yarn
npm run dev
```
2. Send a `GET` request to `/hello-world`:
```bash
curl http://localhost:9000/hello-world
```
In the response, youll receive the following object:
```json
{
"message": "Hello, world!"
}
```
---
## Next Steps
Congratulations, youve made your first customization with Medusa!
You can now start your in-depth learning journey to become an expert.