V 2.0.0 ferige Version
This commit is contained in:
23
app/api/data/route.ts
Normal file
23
app/api/data/route.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { doMySQL } from '@/lib/mysqlinterface';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const options = {
|
||||
curdate: searchParams.get('curdate') ?? undefined,
|
||||
testing: searchParams.get('test') ?? undefined,
|
||||
};
|
||||
const erg = await doMySQL('getlastdata', options);
|
||||
return NextResponse.json(erg);
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const body = await request.json();
|
||||
const options = {
|
||||
data: body,
|
||||
testing: searchParams.get('test') ?? undefined,
|
||||
};
|
||||
const erg = await doMySQL('putdata', options);
|
||||
return NextResponse.json(erg);
|
||||
}
|
||||
Reference in New Issue
Block a user