nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

nextjs/Route Handlers

Building an API endpoint directly inside the App Router, using a route.ts file.

10 QuestionsIntermediateHigh Priority ~11 min read

A route.ts (or .js) file inside the App Router defines a Route Handler — the App Router's replacement for the Pages Router's API routes. It exports functions named after HTTP methods (GET, POST, PUT, DELETE) that receive a standard Web Request and return a standard Web Response, rather than the Next-specific req/res objects the Pages Router used.

A route segment can be a page or a Route Handler, but not both — page.tsx and route.ts can't coexist in the same folder. GET Route Handlers are cached by default unless they read dynamic request data or explicitly opt out, and — like any other route — a Route Handler can run on either the Node or Edge runtime depending on what it actually needs to do.

What you'll walk away knowing

How a Route Handler is defined (route.ts, exported HTTP-method functions) and how it differs from Pages Router API routes
Why route.ts and page.tsx can't both exist in the same route segment
When a GET Route Handler is cached by default, and how to opt it out of caching
How to choose between the Node and Edge runtime for a given Route Handler
1How do you handle CORS in Next.js Route Handlers?Intermediate2What is the difference between API Routes (Pages Router) and Route Handlers (App Router)? What new capabilities do Route Handlers have?Intermediate3List methods supported by route handlers in next js?Intermediate4How to redirect in route handlers?Intermediate5What are Route handlers?Intermediate6How do Route Handlers interact with Next.js caching? How do you make a Route Handler static vs dynamic?Intermediate7How do you implement a streaming response from a Route Handler in Next.js?Intermediate8How do you implement rate limiting on a Next.js Route Handler without an external service?Intermediate9Can Route Handlers replace a separate backend entirely? What are the architectural trade-offs?Advanced10What is the difference between a Route Handler and a Server Action? When would you choose one over the other?Intermediate
All Topics
1
Basics
Project Structure
Runtime
Compiler
2
SSG
SSR
CSR
3
Routing
Route Handlers
Route Groups
Dynamic Routes
Parallel Routes
Intercepting Routes
4
Middleware
Server Actions
APIS
Data Fetching
Caching
Clients
5
Optimisation
i18n
Security
Architecture
Deployment
Accessibility
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.