![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@aldojs/middleware
Advanced tools
A middleware dispatcher and composer for Node.js applications. It provides a clean way to register and invoke a chain of middleware functions.
npm add @aldojs/middleware
To create a new Dispatcher
instance, you may use createDispatcher
utility:
let { createDispatcher } = require('@aldojs/middleware')
let dispatcher = createDispatcher()
Registering middlewares can be done using Dispatcher::use
method
dispatcher.use(function middleware () { return 123 })
To dispatch some input data to the middleware chain, and await the result, you may use the Dispatcher::dispatch
method
let result = await dispatcher.dispatch({ input: 'foobar' })
Dispatcher::dispatch
accepts any input, not only objects.
Each middleware could return any output value including promises.
Whether a middleware runs before or after a downstream middlewares depends on the middleware itself. For example, the following middleware would perform some task before the others
dispatcher.use((input, next) => {
// Perform task
return next()
})
However, this middleware would perform its task after the input is handled by the following middlewares
dispatcher.use(async (input, next) => {
let result = await next()
// Perform the task
return result
})
Composing multiple middleware to make a single handler is easy using the compose
utility:
const { compose } = require('@aldojs/middleware')
let middleware = compose([
someMiddleware,
AnotherMiddleware,
WhyNotAThirdMiddleware
])
FAQs
Middleware disptacher and composer
We found that @aldojs/middleware demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.