import Select from "../../../server/db/select";
import type { NextApiRequest, NextApiResponse } from 'next';

const sql = "SELECT items.id, podcasts.link_plafthorm_ya, podcasts.link_plafthorm_go, urlImg,items.description, items.title_items, items.audio, DATE_FORMAT(items.pubDate, '%d - %m - %Y') as datePub FROM podcasts, items WHERE podcasts.id=items.id_podcasts and items.status=1 ORDER BY items.pubDate DESC";

export default function handler(
    req: NextApiRequest,
    res: NextApiResponse
  )   {
    Select(sql, function(data){
        res.status(200).json(data);
    })
}