NextJs — API Routes
Next.js allows you to create serverless API endpoints inside the pages/api
folder. Each file in this folder becomes an endpoint.
pages/api/hello.js
export default function handler(req, res) {
res.status(200).json({ message: 'Hello API!' });
}