You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
607 B
20 lines
607 B
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
import { QueryError, RowDataPacket } from 'mysql2';
|
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
import Init from "../../server/db/connect";
|
|
|
|
type Data = {
|
|
QueryError: string,
|
|
RowDataPacket: string
|
|
}
|
|
|
|
export default function handler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse<Data>
|
|
) {
|
|
if (req.method === 'POST') {
|
|
Pool.query('SELECT 1 + 1 AS solution', (err: QueryError, rows: RowDataPacket[]) => {
|
|
console.log('The solution is: ', rows[0]['solution']);
|
|
});
|
|
}
|
|
}
|
|
|