Package dev.relism.flash.extension
Class FlashScope
Scoped builder for namespace-prefixed routes. Pure syntactic sugar —
does not own a router. Routes merge into
FlashApp's single flat router
at FlashApp.start().
app.mount("/api", scope -> {
scope.use(authMiddleware);
scope.get("/health", (req, res) -> "ok"); // → GET /api/health
scope.get("/users", (req, res) -> "...", rateLimiter); // → GET /api/users
scope.scan("dev.example.api.handlers");
});
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidRegisters a middleware in this registrar's own scope (global or scope-level).protected voidaddRoute(HttpMethod method, String path, RequestHandler handler, List<Middleware> mw) Adds a route immediately to this registrar's deferred compilation list.protected voidaddWsRoute(String path, WebSocketEndpoint endpoint) ctx()Returns theFlashContextfor this registrar.Methods inherited from class dev.relism.flash.extension.FlashRegistrar
connect, delete, get, head, instantiate, instantiateWs, options, patch, post, purge, put, scan, trace, use
-
Method Details
-
ctx
Description copied from class:FlashRegistrarReturns theFlashContextfor this registrar.- Specified by:
ctxin classFlashRegistrar<FlashScope>
-
addRoute
protected void addRoute(HttpMethod method, String path, RequestHandler handler, List<Middleware> mw) Description copied from class:FlashRegistrarAdds a route immediately to this registrar's deferred compilation list. Subclasses may prepend a namespace prefix and inject scope middlewares before storing.- Specified by:
addRoutein classFlashRegistrar<FlashScope>
-
addWsRoute
- Specified by:
addWsRoutein classFlashRegistrar<FlashScope>
-
addMiddleware
Description copied from class:FlashRegistrarRegisters a middleware in this registrar's own scope (global or scope-level).- Specified by:
addMiddlewarein classFlashRegistrar<FlashScope>
-