Skip to main content

HttpNext Pipeline

Copy-Paste Example

More Examples

Recommended layout:
Use 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

  • HttpNext wraps an internal Http instance.
  • 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.
  • specialControllers load 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 with shutdown.
  • Controllers live under the configured controller directory.
  • API routes use the configured prefix, default /-.
  • Next.js production build runs before hile start in production.