next.js
19b9691f - [experiment] support App Router route.go handlers (#100130)

Commit
28 days ago
[experiment] support App Router route.go handlers (#100130) ## Summary Add experimental App Router `route.go` handlers on top of #99980. With `experimental.goRoutes: true` and Turbopack, a Go `package main` declares `func GET(w http.ResponseWriter, r *http.Request)`, `POST`, and other HTTP methods. Generated dispatch supplies automatic HEAD/OPTIONS behavior and lets Go validate handler signatures. Go source discovery, declaration analysis, compilation, persistent caching, target construction, and compiler lifecycle live in `turbopack-go` in #99980. This PR supplies Next.js route conventions, generated HTTP entrypoints, native endpoint metadata, and runtime integration. NAPI uses the endpoint's external-input validity interface instead of inspecting Go filesystems. Development and self-hosted `next start` keep routing, rewrites, and `proxy.ts` in Node.js. Supervised private Go workers preserve streaming, headers, cookies, parameters, cancellation, and recovery after edits or process failures. Production retries transient worker startup failures. Deployment adapters receive existing `APP_ROUTE` output fields with `runtime: 'go'` and an executable `filePath`. Their `goTarget` option selects the executable target; copied PORT-based servers run without Next.js or the Go toolchain. Adapter routing metadata and parameter handling remain part of the Next.js integration. Hosted deploy-test limitations are documented in the fixture README. Unrelated image-scrolling assertions are separated into #101009. ## Verification - Rust clippy passed for `turbopack-go`, `next-api`, and `next-napi-bindings` with warnings denied. - Full workspace/native build and repository TypeScript check passed. - Lower PR: new source/declaration/cache tests and fresh-process persistence checks passed. Existing native-event watch failures are documented on #99980. - Go-route development: 18 passed. Production: 15 passed, including host/amd64/arm64 adapter outputs. Server tracing: six tests and five snapshots passed. - Development tests use the existing polling configuration because native macOS filesystem event tests fail independently on this machine. <!-- NEXT_JS_LLM --> --------- Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Author
Parents
Loading