import Link from "next/link"; import { pool } from "@/lib/db"; type Post = { id: number; title: string; description: string; created_at: string; }; export default async function HomePage() { let posts: Post[] = []; try { const conn = await pool.getConnection(); posts = await conn.query( ` SELECT id, title, description, created_at FROM posts ORDER BY created_at DESC LIMIT 3 ` ); conn.release(); } catch (err) { console.error("Failed to load posts:", err); } return (
{/* ================= HERO ================= */}

Welcome to Surafino

A modern blog and news platform focused on technology, development and digital projects.

Read articles View news
{/* ================= LATEST POSTS ================= */}

Latest posts

View more
{posts.length === 0 ? (

No posts have been published yet.

) : (
{posts.map(post => (

{post.title}

{post.description}

Read more →
))}
)}
{/* ================= ABOUT ================= */}

About Surafino

Surafino is a personal blog and news platform built with modern web technologies. It allows publishing articles with rich content, managing posts through a private admin panel, and supports light and dark mode for better readability.

); }