From c1b71fca64f9e84b63447b5fa7923d41637727d6 Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Sun, 15 Jun 2025 13:54:35 +0800 Subject: [PATCH] add helloworld API endpoint for product module with test case --- .../src/app/api/product/helloworld/route.ts | 16 ++++++++++++++++ .../src/app/api/product/helloworld/test.http | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 03_source/cms_backend/src/app/api/product/helloworld/route.ts create mode 100644 03_source/cms_backend/src/app/api/product/helloworld/test.http diff --git a/03_source/cms_backend/src/app/api/product/helloworld/route.ts b/03_source/cms_backend/src/app/api/product/helloworld/route.ts new file mode 100644 index 0000000..16cbacf --- /dev/null +++ b/03_source/cms_backend/src/app/api/product/helloworld/route.ts @@ -0,0 +1,16 @@ +import type { NextRequest, NextResponse } from 'next/server'; + +import { STATUS, response, handleError } from 'src/utils/response'; + +/** + *************************************** + * GET - helloworld + *************************************** + */ +export async function GET(req: NextRequest, res: NextResponse) { + try { + return response({ helloworld: 'product' }, STATUS.OK); + } catch (error) { + return handleError('Helloworld - Get all', error); + } +} diff --git a/03_source/cms_backend/src/app/api/product/helloworld/test.http b/03_source/cms_backend/src/app/api/product/helloworld/test.http new file mode 100644 index 0000000..0eb0ce3 --- /dev/null +++ b/03_source/cms_backend/src/app/api/product/helloworld/test.http @@ -0,0 +1,4 @@ +### +GET /api/product/helloworld HTTP/1.1 +Host: localhost:7272 +