A narrow Next-owned health response
// app/api/web-status/route.ts
export function GET() {
return Response.json({ web: 'ok' });
}This is a web-adjacent response with no duplicate product domain logic.
Topic
Definition
Route Handlers are Next.js request handlers defined in route.ts that can return HTTP responses for web-adjacent endpoints.
In simpler words
They handle narrow Next-owned HTTP work; they are not a second home for the product backend.
Keeping ownership clear prevents ticket rules, authentication, and validation from drifting across two servers.
A Route Handler can serve a Next-specific integration edge, such as a web-only callback or a narrow adapter. It is defined beside the relevant app route and returns a standard HTTP response.
Nest already owns product REST endpoints, TypeORM persistence, cookie JWT guards, and domain rules. Duplicating those endpoints in app/api creates two implementations that can disagree.
// app/api/web-status/route.ts
export function GET() {
return Response.json({ web: 'ok' });
}This is a web-adjacent response with no duplicate product domain logic.
// Wrong — app/api/tickets/route.ts reimplements ticket creation
export async function POST(request: Request) { /* validate + write tickets */ }
// Right — the browser calls the Nest tickets API through its established clientOne product resource needs one authoritative validation and authorization path.
Definition
A handler’s location does not decide product ownership; the domain, authentication model, and consumers do.
In simpler words
Document why a Next handler exists so it does not become an accidental parallel API.
Validate and authenticate any handler according to its own threat model.
Avoid proxying an endpoint merely to conceal a missing API contract decision.
Live playground
Classify each endpoint as Next-owned edge work or Nest product API work.
Nest: TypeORM, cookie JWT, domain rules.
Test
At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥ 80% (enforced by the API) to save progress.
Checking your session…
10 questions · concept 3 · syntax 2 · practical 3 · logic 2