
Research
/Security News
11 Malicious NuGet Tools Pose as Game Cheats to Drop a Windows Host-Surveillance Payload
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.
@fluojs/http
Advanced tools
HTTP execution layer — routing, guards, interceptors, DTO binding, and exception handling for Fluo.
English 한국어
The HTTP execution layer that turns route metadata into a request pipeline with binding, validation, guards, interceptors, and response writing.
npm install @fluojs/http
Use this package when you need to:
@Controller, @Get, and @Post@FromBody, @FromPath, @FromQuery, and related decoratorsRequestContext without passing it through every functionimport { Controller, FromBody, FromPath, Get, Post, RequestDto } from '@fluojs/http';
import { IsString, MinLength } from '@fluojs/validation';
class CreateUserDto {
@FromBody()
@IsString()
@MinLength(3)
name!: string;
}
@Controller('/users')
export class UserController {
@Post('/')
@RequestDto(CreateUserDto)
create(input: CreateUserDto) {
return { id: '1', name: input.name };
}
@Get('/:id')
getById(@FromPath('id') id: string) {
return { id, name: 'John Doe' };
}
}
HTTP route decorators such as @Controller(), @Get(), and @Post() accept only:
/users or /healthz/:id or /users/:userId/posts/:postIdTrailing slashes and duplicate slashes are normalized during route mapping, so //users///:id/ resolves to /users/:id.
Route decorators do not support wildcard, regex-like, or mixed-segment syntax such as *, ?, /(.*), user-:id, or :id.json. Wildcard matching remains middleware-only via forRoutes('/users/*').
import { Controller, Get, UseGuards, UseInterceptors } from '@fluojs/http';
@Controller('/admin')
@UseGuards(AdminGuard)
@UseInterceptors(LoggingInterceptor)
class AdminController {
@Get('/')
dashboard() {
return { data: 'secret' };
}
}
import { getCurrentRequestContext } from '@fluojs/http';
function someDeepHelper() {
const ctx = getCurrentRequestContext();
console.log(ctx?.requestId);
}
runWithRequestContext(...) preserves the active context across awaited work when the host provides AsyncLocalStorage through globalThis.AsyncLocalStorage or Node's built-in node:async_hooks module. Node runtimes in the declared >=20.0.0 support range keep ALS semantics even when process.getBuiltinModule(...) is unavailable by resolving node:async_hooks dynamically. Non-Node hosts without an async-context primitive use a synchronous stack fallback that clears the context before awaited continuations resume, avoiding cross-request leaks instead of pretending to isolate overlapping async work.
createRateLimitMiddleware(...) resolves client identity from the raw socket remoteAddress by default. To trust Forwarded, X-Forwarded-For, or X-Real-IP, opt in with trustProxyHeaders: true only when your adapter sits behind a trusted proxy that overwrites those headers. If your adapter exposes neither a trusted proxy chain nor a raw socket identity, provide an explicit keyResolver.
import { Get, SseResponse, type RequestContext } from '@fluojs/http';
@Get('/events')
stream(_input: undefined, ctx: RequestContext) {
const sse = new SseResponse(ctx);
sse.send({ message: 'hello' });
return sse;
}
createHandlerMapping(...) supports URI, header, media-type, and custom versioning strategies through VersioningType and the versioning option. Route registration keeps exact/static matches ahead of fallbacks while preserving registration order for equivalent normalized routes.
Use runWithRequestContext(...), assertRequestContext(), createRequestContext(...), createContextKey(...), getContextValue(...), and setContextValue(...) when framework integrations need explicit request context boundaries or typed per-request storage.
The dispatcher exposes fast-path observability for adapters and diagnostics through FAST_PATH_ELIGIBILITY_SYMBOL, FAST_PATH_STATS_SYMBOL, formatFastPathStats(...), and getDispatcherFastPathStats(...).
Fluo's HTTP decorators are standard TC39 decorators and continue to record metadata through context.metadata when the runtime or compiler provides the standard decorator context. When Bun bundles an application through its legacy TypeScript decorator transform, the same controller, route, DTO binding, guard/interceptor, header, redirect, versioning, status, request DTO, and @Produces(...) metadata is recorded through Fluo's internal metadata stores so generated Bun bundles preserve route mapping behavior.
This compatibility path is an execution fallback for Bun bundle output; application source should still use Fluo's standard decorators and should not enable emitDecoratorMetadata or rely on reflect-metadata.
The dispatcher binds RequestContext with host async-context storage for the active dispatch only. On hosts with AsyncLocalStorage, including supported Node 20+ runtimes, the context remains available across awaited work. On non-Node hosts without an async-context primitive, the fallback context is synchronous-only and intentionally unavailable after await so overlapping requests cannot observe one another's context. When a request may use request-scoped DI through its controller graph, middleware, guards, interceptors, observers, DTO converters, a custom binder, or manual getCurrentRequestContext() / assertRequestContext() container access, the dispatcher creates and disposes an isolated request-scoped DI container from its finally path after request observers finish. Singleton-only routes skip that container lifecycle until RequestContext.container is accessed, so the baseline path avoids unnecessary per-request allocation while preserving request-scoped provider isolation whenever the graph is ambiguous or request-scoped. Public RequestContext.container reads are therefore always safe for resolving request-scoped providers; the singleton-only fast path is an internal dispatcher optimization, not a promise that the public context exposes the root container.
Adapters should pass an AbortSignal on FrameworkRequest.signal when the platform exposes one. For SSE, adapters should also expose FrameworkResponse.stream.onClose(...) when possible; SseResponse listens to both request abort and raw stream close, closes idempotently, and removes registered listeners when either side terminates first.
Controller, Get, Post, Put, Patch, Delete, All, Options, HeadFromBody, FromQuery, FromPath, FromHeader, FromCookie, RequestDto, Optional, ConvertUseGuards, UseInterceptors, HttpCode, Version, Header, Redirect, ProducesRequestContext, FrameworkRequest, FrameworkResponse, SseResponseHttpApplicationAdapter, createNoopHttpApplicationAdapter, createServerBackedHttpAdapterRealtimeCapability, createUnsupportedHttpAdapterRealtimeCapability, createFetchStyleHttpAdapterRealtimeCapabilityHttpException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, NotAcceptableException, TooManyRequestsException, InternalServerErrorException, PayloadTooLargeException, createErrorResponse, RouteConflictError, InvalidRoutePathError, HandlerNotFoundError, RequestAbortedErrorcreateHandlerMapping, createDispatcher, forRoutes, normalizeRoutePattern, matchRoutePattern, isMiddlewareRouteConfig, createCorrelationMiddleware, createCorsMiddleware, createRateLimitMiddleware, createSecurityHeadersMiddleware, runWithRequestContext, getCurrentRequestContext, assertRequestContext, createRequestContext, createContextKey, getContextValue, setContextValue, encodeSseComment, encodeSseMessageCorsOptions, RateLimitOptions, RateLimitStore, SecurityHeadersOptions, SseSendOptions@fluojs/http/internal)The ./internal subpath exports only the low-level utilities used by platform adapters and the core runtime. These are subject to change and should not be used in typical application code.
DefaultBinder: Default DTO/request binder used by the runtime bootstrap path.bindRawRequestNativeRouteHandoff(...) / attachFrameworkRequestNativeRouteHandoff(...): Internal adapter/runtime helpers for reusing semantically safe native route matches without widening the public dispatcher API.consumeRawRequestNativeRouteHandoff(...) / readFrameworkRequestNativeRouteHandoff(...): Internal helpers for reading or consuming native route handoffs.isRoutePathNormalizationSensitive(path): Internal guard for keeping duplicate-slash and trailing-slash requests on the generic dispatcher path.resolveClientIdentity(request): Conservative client identity resolver used by rate limiting and other runtime integrations.createFetchStyleHttpAdapterRealtimeCapability(...), Dispatcher, and HttpApplicationAdapter: internal adapter seams for edge/fetch-style platform packages that must avoid instantiating the full HTTP root barrel.@fluojs/core: stores controller, route, and DTO metadata@fluojs/validation: validates DTOs after HTTP binding@fluojs/runtime: assembles the dispatcher during application bootstrap@fluojs/passport: plugs auth guards into the same HTTP guard chainexamples/realworld-api/src/users/create-user.dto.tsexamples/auth-jwt-passport/src/auth/auth.controller.tspackages/http/src/dispatch/dispatcher.test.tsFAQs
HTTP execution layer — routing, guards, interceptors, DTO binding, and exception handling for Fluo.
The npm package @fluojs/http receives a total of 29 weekly downloads. As such, @fluojs/http popularity was classified as not popular.
We found that @fluojs/http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.

Research
/Security News
4 compromised asyncapi packages deliver miasma botnet loader on macOS, Linux and Windows.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.