Advertisement
djbob2000

Untitled

Jul 24th, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //create a new directory structure: app/api/crud/route.ts
  2.  
  3. import { NextRequest, NextResponse } from 'next/server';
  4. import { crudPut } from "@server/meta/fd-meta/controllers/generic-controllers/crud-controller";
  5. import { EditResource } from "@server/meta/fd-meta-core/crud/edit-resource";
  6. import { WithId } from "@server/fd/fd-toolbox-core/base-resource/with-id";
  7.  
  8. export async function PUT(request: NextRequest) {
  9.     const editResource: EditResource<WithId> = await request.json();
  10.     const result = await crudPut(editResource);
  11.     return NextResponse.json(result);
  12. }
  13.  
  14. export async function GET() {
  15.     return NextResponse.json({ message: 'GET method not implemented' }, { status: 405 });
  16. }
  17.  
  18. export async function POST() {
  19.     return NextResponse.json({ message: 'POST method not implemented' }, { status: 405 });
  20. }
  21.  
  22. export async function DELETE() {
  23.     return NextResponse.json({ message: 'DELETE method not implemented' }, { status: 405 });
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement