init commit,
This commit is contained in:
16
03_source/cms_backend/src/app/api/helloworld/list/route.ts
Normal file
16
03_source/cms_backend/src/app/api/helloworld/list/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { STATUS, response, handleError } from 'src/utils/response';
|
||||
|
||||
import prisma from '../../../lib/prisma';
|
||||
|
||||
export async function GET(req: NextRequest, res: NextResponse) {
|
||||
try {
|
||||
const products = await prisma.productItem.findMany();
|
||||
console.log({ products });
|
||||
|
||||
return response({ products }, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Post - Get latest', error);
|
||||
}
|
||||
}
|
16
03_source/cms_backend/src/app/api/helloworld/route.ts
Normal file
16
03_source/cms_backend/src/app/api/helloworld/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { STATUS, response, handleError } from 'src/utils/response';
|
||||
|
||||
import prisma from '../../lib/prisma';
|
||||
|
||||
export async function GET(req: NextRequest, res: NextResponse) {
|
||||
try {
|
||||
const users = await prisma.user.findMany();
|
||||
console.log({ users });
|
||||
|
||||
return response({ users }, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Post - Get latest', error);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user