// Next.js API route support: https://nextjs.org/docs/api-routes/introduction import type { NextApiRequest, NextApiResponse } from 'next'; import Pool from "../../server/db/connect"; type Data = { name: string } export default function handler( req: NextApiRequest, res: NextApiResponse ) { if (req.method === 'POST') { Pool.query('SELECT 1 + 1 AS solution', (err: QueryError, rows: RowDataPacket[]) => { console.log('The solution is: ', rows[0]['solution']); }); } }