Tutorials Courses Interview Prep (100 Q&A) AI Tools (50) Developer Tools (50) Tracks Pricing Plans Blog & Articles Contact Us
Next.js 15 App Router Architecture 16 mins read Free Lesson

Dynamic Routes & Route Handlers (app/api/)

Build dynamic paths with [slug] and create JSON REST handlers in route.ts files.

Route Handlers in Next.js

// app/api/tutorials/route.ts
import { NextResponse } from 'next/server';

export async function GET() {
    return NextResponse.json([
        { slug: 'complete-nextjs-tutorial', title: 'Next.js 15 Tutorial', free: true }
    ]);
}