Response
Introduction
Every HTTP handler receives an Express Response object. JCC Express MVC types it as AppResponse (jcc-express-mvc/lib/Interface): it is the same instance passed as res in route closures and in { req, res, next } / httpContext patterns.
Early in the global middleware stack, HttpResponse (jcc-express-mvc/lib/Response/index.ts) wraps each pair (req, res) and attaches res.with and res.redirectBack. If you register inertia(...) in the HTTP kernel, the Inertia middleware adds res.inertia and res.inertiaRedirect.
Use the global response() helper to resolve the current AppResponse from the container (only during an HTTP request, after per-request binding).
Types: import type { Response } from "jcc-express-mvc" as the AppResponse alias (export type { AppResponse as Response }).
When extensions are available
with and redirectBack are wired when HttpResponse is constructed (same phase as HttpRequest helpers). inertia and inertiaRedirect exist only after the inertia({ rootView, ssr, ... }) middleware runs, which must be in your kernel’s middlewares array if you use Inertia.
Flash and redirects
res.with(message, type?)— Flashes a message (default flash typesuccess). UsesjccSession.flashwhen available, otherwisereq.flash. Returnsresfor chaining. SeeSession.mdfor how session and flash fit together.res.redirectBack()— Redirects with status 303 to theRefererheader, or the first entry in the framework’s tracked URL list, or/as a fallback.
Globals redirect(url, status?) (default status 303) and back(url?) (explicit URL or redirectBack) call through the bound response.
Inertia
Requires inertia(...) in the kernel (see Getting-Started/Frontend.md for rootView, ssr, version, shared props).
await res.inertia(component, props?, option?)— For XHR Inertia visits (X-Inertiaheader), responds with JSON (page object, version checks, partial reloads viaX-Inertia-Partial-Data). For a full load, rendersrootViewwithinertia,ssrHead,ssrBodywhen SSR is enabled and the SSR server is reachable.res.inertiaRedirect(url)— If the request is Inertia, setsX-Inertia-Locationand responds with 409; otherwiseres.redirect(303, url).
Global inertia(component, props?, option?) delegates to res.inertia.
Server-rendered views
Use Express’s res.render(view, locals?, callback?) with your configured view engine (Blade-style templates, etc.). The global view(name, options?, callback?) helper resolves response and calls render. For paths, configuration, and Route.view, see Views.md; for the Blade engine itself, see JCC-Blade.md (same folder).
res.locals is populated by the framework where relevant—for example validation errors and old input from HttpRequest, and _token for CSRF when csrf() is active (see Request.md and CSRF-protection.md).
Standard Express behavior
Everything from express.Response still applies, including:
res.status(code),res.json(body),res.send(body),res.end()res.redirect(statusOrUrl, url?)(Express overload rules)res.set/res.get,res.cookie/res.clearCookieres.headersSent— useful before callingredirectorjsontwice
If your route handler returns a non-undefined value and the response is not yet sent, the route wrapper may serialize it as JSON (see router registration in RouteBuilder).
