Class FlashApp


public final class FlashApp extends FlashRegistrar<FlashApp>
Single entry point for Flash. Owns one flat FastPathRouterImpl — all routes (app-level and scoped) compile into a single FSM at startup.

 FlashApp.create(8080)
     .install(new JacksonExtension())
     .use(cors)
     .get("/ping",    (req, res) -> "pong")
     .get("/secured", (req, res) -> user(), oidc.protect())
     .scan("dev.example.handlers")
     .mount("/api", scope -> scope.get("/health", (req, res) -> "ok"))
     .startAndBlock();   // blocks main thread
 

Startup sequence (both start() and startAndBlock())

  1. Extensions sorted by FlashExtension.priority() — lower first.
  2. All FlashExtension.provide(dev.relism.flash.extension.FlashContext) — register services, processors, listeners.
  3. FlashContext.resolveAll() — topo-sort, cycle detection.
  4. All FlashExtension.routes(dev.relism.flash.extension.FlashRegistrar<?>, dev.relism.flash.extension.FlashContext) — routes registered, services available.
  5. Compile all routes into one flat FSM — zero prefix scanning at runtime.
  6. Accept loop started.

Default error handlers

Dev mode (-Dflash.env=dev): rich HTML with stack traces. Prod mode (default): generic JSON — no internal details leaked. Override via onException(dev.relism.flash.routing.AbstractRouter.ExceptionHandler) / onNotFound(dev.relism.flash.models.SimpleHandler.FunctionalHandler).