@alterior/http
Advanced tools
Changelog
v3.11.1
@/web-server
globalMiddleware
option to @Controller()
. This has the same semantics as middleware
in previous releases,
but with clarified naming.middleware
option of @Controller()
is now deprecated in favor of globalMiddleware
.@Body({ type: 'json' })
feature because of
body-parser
's "strict mode". Disabled "strict mode" when using the JSON mode of the body-parser
middleware
internally.Changelog
v3.11.0
@/annotations
Annotation.decorator()
so that it is dependent on the provided valueTargets
(when
possible). Issue@/web-server
@Body()
decorator. This is useful for cases like trying
to accept JSON strings (since string
normally causes a text
body parser to be used).Changelog
v3.10.0
@/di
Injector.run()
to run a callback within an injection context for the given injector.Changelog
v3.9.0
@/web-server
@WebService()
, @Controller
or the @Route()
family
of decorators. They are similar to applying a mutator, but without needing to use decorators, and without needing
to declare the interception on every controller method. Use WebEvent.current
to access details about the request.@Intercept()
decorator as a convenient way to apply a function conforming to the Interceptor
type directly
to a method definition.WebEvent.inject()
is a convenience function for WebEvent.current.get()
webEvent.inject()
is a convenience function for webEvent.server.injector.get()
Changelog
v3.8.0
@/web-server
WebEvent.current
to acquire the web event being processed. While middleware
has always had access to the request/response pair, the current WebEvent also provides access to the controller and
method which is about to be executed, amongst other things. This enables middleware to introspect the method call
that is about to occur, enabling a broad set of use cases that were previously impossible. NOTE: Global and
controller-level middleware cannot access WebEvent.current
as they occur before any Alterior-specific
processing occurs.WebEvent
to be dependency injected as an alternative way of
acquiring it.preRouteMiddleware
and postRouteMiddleware
options allow you to specify route-specific middleware at
the global and controller levels, enabling you to use the new introspection capabilities without specifying
middleware on every route. The order of application is: (1) global pre-middleware, (2) controller pre-middleware,
(3) route-specific middleware, (4) controller post-middleware, (5) global post-middleware.@Middleware()
. All classes are now treated as
Alterior-style middleware (dependency injected, implements a handle()
method). This is not a breaking change
since passing a class not marked with @Middleware()
would have caused a runtime error prior. As a result of
this @Middleware()
has been deprecated, and will be removed in 4.0.0.WebServerOptions
, @Controller()
and
the @Route()
family of decorators has been strengthened.@/common
: Adds leftPad()
, rightPad()
, zeroPad()
and isConstructor()
Changelog
v3.7.5
@/web-server
:
@WebService
classes@/web-server
may have been needed even
though @/web-server
does not have a direct dependency on Express@/common
: getParameterNames()
will now look for a __parameterNames
property and use that before trying to
introspect the function, which allows code that transforms/replaces functions to carry parameter name metadata
across more easily.@/annotations
:
__parameterNames
property on the resulting function, containing the parameter names of the original function.Mutator.create()
and Mutator.define()
Changelog
v3.7.4
@/runtime
: Add parentInjector
bootstrap option to allow for more complex application bootstrapping.