@alterior/express
Advanced tools
Changelog
v3.9.4
@/web-server
Response
class would cause an exception
within Express. Failing to provide a body now ends the response without outputting a body.ConnectMiddleware
to require the next()
function to be passed.
This fixes type errors when using many Connect middlewares.Changelog
v3.9.3
@/express
ExpressEvent
now properly exposes current
as an Express-specific WebEvent
,
request
as express.Request
and response
as express.Response
as intended.
Previously this class returned the same values as WebEvent
which was not useful.Changelog
v3.9.2
@/web-server
Session.current().foo = 123
would not set the session variable as expected.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.6
@/web-server
: [(!!) Potential security issue] Fixes an issue which causes the optional secondary HTTP listener to
be enabled even when not configured. This would cause Alterior web services to listen on a random high TCP port in
addition to the primary port you configure. This may be security impacting for some deployment / firewall
configurations.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.