HttpNext Pipeline
Copy-Paste Example
More Examples
Recommended layout:loadModel() from pages or controllers for domain logic. If a Next.js page uses runtime model data, mark the route dynamic:
Runtime And Lifecycle Notes
HttpNextwraps an internalHttpinstance.- It serves
publicPath, then.next/static, then Hile controllers, then Next.js as the fallback handler. - Development mode is determined by
process.env.NODE_ENV === 'development'. - Controller directory is
{cwd}/src/{controllerDirectory}in development and{cwd}/dist/{controllerDirectory}in production. specialControllersload additional controller roots with their own prefixes.
Anti-Patterns
- Putting API routes in Next.js when the app is intentionally using Hile controllers.
- Calling
loadService()at module top level in Next.js files. - Forgetting
cwd; relative controller and Next artifact paths depend on it.
Verification Checklist
HttpNext.start()close function is registered withshutdown.- Controllers live under the configured controller directory.
- API routes use the configured prefix, default
/-. - Next.js production build runs before
hile startin production.