Module 08 of 10

Route Handlers & Databases

Lessons

About This Module

A Route Handler is a route.ts file that lets you define custom request handlers for a URL using the standard Web Request and Response APIs. Export a function named after an HTTP method (GET, POST, PUT, PATCH, DELETE) and you have an API endpoint, with support for dynamic segments like [id] and JSON responses through NextResponse.

Endpoints become useful once they read and write real data. This module then shows how to add Prisma to a Next.js project, connect it to a PostgreSQL database, and query it from your server code. Some videos were recorded for Next.js 13 and 14, and a few Prisma setup details differ in newer versions, so check the current docs when you follow along.

Watch the lessons in order, then continue on to Authentication & Security.

Lessons

4 videos
01

Route Handlers GET - Next.js 14 Course Tutorial #30

Shows how to use route handlers to create API endpoints in Next.js, starting with GET requests.

02

Next.js 13 API Route Handlers FULL CRUD

Covers GET, POST, PUT and DELETE route handlers, how to use parameters, and how to return JSON objects.

03

Add Prisma to Next.js App Router Project

Integrates Prisma into a Next.js App Router project.

04

The Correct Way to Connect Next.js with Supabase & Prisma (PostgreSQL Tutorial)

A step-by-step walkthrough of connecting a Next.js 14 app to a Supabase PostgreSQL database using Prisma ORM.