Skip to content

Commit 4673b59

Browse files
committed
feat: add educational comments to api endpoints
1 parent b74f21f commit 4673b59

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/app/api/collections/[handle]/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { ProductCollectionDTO } from "@medusajs/types/dist/product"
44
import { notFound } from "next/navigation"
55
import getPrices from "@lib/util/get-product-prices"
66

7+
/**
8+
* This endpoint uses the serverless Product Module to retrieve a collection and its products by handle.
9+
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
10+
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
11+
*/
712
export async function GET(
813
request: NextRequest,
914
{ params }: { params: Record<string, any> }

src/app/api/collections/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { NextRequest, NextResponse } from "next/server"
22
import { initialize as initializeProductModule } from "@medusajs/product"
33
import { notFound } from "next/navigation"
44

5+
/**
6+
* This endpoint uses the serverless Product Module to list and count all product collections.
7+
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
8+
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
9+
*/
510
export async function GET(request: NextRequest) {
611
const productService = await initializeProductModule()
712

src/app/api/products/[handle]/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import getPrices from "@lib/util/get-product-prices"
33

44
import { initialize as initializeProductModule } from "@medusajs/product"
55

6+
/**
7+
* This endpoint uses the serverless Product Module to retrieve a product by handle.
8+
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
9+
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
10+
*/
611
export async function GET(
712
request: NextRequest,
813
{ params }: { params: Record<string, any> }

src/app/api/products/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import {
88
} from "@medusajs/types/dist/product/common"
99
import { notFound } from "next/navigation"
1010

11+
/**
12+
* This endpoint uses the serverless Product Module to retrieve a list of products.
13+
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
14+
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
15+
*/
1116
export async function GET(request: NextRequest) {
1217
const queryParams = Object.fromEntries(request.nextUrl.searchParams)
1318

0 commit comments

Comments
 (0)