Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //create a new directory structure: app/api/crud/route.ts
- import { NextRequest, NextResponse } from 'next/server';
- import { crudPut } from "@server/meta/fd-meta/controllers/generic-controllers/crud-controller";
- import { EditResource } from "@server/meta/fd-meta-core/crud/edit-resource";
- import { WithId } from "@server/fd/fd-toolbox-core/base-resource/with-id";
- export async function PUT(request: NextRequest) {
- const editResource: EditResource<WithId> = await request.json();
- const result = await crudPut(editResource);
- return NextResponse.json(result);
- }
- export async function GET() {
- return NextResponse.json({ message: 'GET method not implemented' }, { status: 405 });
- }
- export async function POST() {
- return NextResponse.json({ message: 'POST method not implemented' }, { status: 405 });
- }
- export async function DELETE() {
- return NextResponse.json({ message: 'DELETE method not implemented' }, { status: 405 });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement