update
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { writeFile, readFile } from 'fs/promises';
|
||||
import { mkdir, writeFile, readFile } from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
const filePath = path.resolve(process.cwd(), 'contactMessages.json');
|
||||
const filePath = path.resolve(process.cwd(), 'data', 'contactMessages.json');
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
await mkdir(path.dirname(filePath), { recursive: true });
|
||||
|
||||
const body = await request.json();
|
||||
const { first_name, last_name, phone, email, message } = body;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user