Gathering detailed insights and metrics for @adonisjs/middleware-base
Gathering detailed insights and metrics for @adonisjs/middleware-base
Gathering detailed insights and metrics for @adonisjs/middleware-base
Gathering detailed insights and metrics for @adonisjs/middleware-base
Very specific code written to make middleware work with Http and Websocket server.
npm install @adonisjs/middleware-base
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
6 Stars
8 Commits
1 Forks
7 Watchers
7 Branches
5 Contributors
Updated on Aug 30, 2024
Latest Version
1.0.0
Package Id
@adonisjs/middleware-base@1.0.0
Unpacked Size
15.05 kB
Size
4.35 kB
File Count
5
NPM Version
5.5.1
Node Version
9.0.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This repo contains the code to make middleware work with the HTTP and Websocket server. If you are looking for generic middleware library, try co-compose.
const MiddlewareBase = require('@adonisjs/middleware-base')
const middleware = MiddlewareBase('handle')
// register global middleware
middleware.registerGlobal(['App/Middleware/BodyParser'])
await middleware
.getGlobalAndNamed([])
.params([ctx])
.run()
void
Register global middleware
void
Register server type middleware
void
Register an object of named middleware
Runner
Composes server level middleware
Runner
Composes global and named middleware together. Pass empty array when no named middleware are supposed to be executed.
MiddlewareBase class is a simple abstraction written to work just with AdonisJs middleware layer.
Adonis has global, named and server middleware with a slight difference in each. So this class understands all and offers a simple abstraction around them.
Param | Type | Description |
---|---|---|
middlewareFn | String | The function to be called on middleware class |
[warnFn] | function |
void
Register global middleware
Kind: global function
Throws:
InvalidArgumentException
If middleware is not an arrayParam | Type |
---|---|
middleware | Array |
Example
1middleware.registerGlobal([ 2 'Adonis/Middleware/BodyParser', 3 'Adonis/Middleware/Session' 4])
void
Register server type middleware
Kind: global function
Throws:
InvalidArgumentException
If middleware is not an arrayParam | Type |
---|---|
middleware | Array |
Example
1middleware.use(['Adonis/Middleware/Static'])
void
Register an object of named middleware
Kind: global function
Throws:
InvalidArgumentException
If middleware is not an object with key/value pair.Param | Type |
---|---|
middleware | Object |
Example
1middleware.registerNamed({ 2 auth: 'Adonis/Middleware/Auth' 3})
Runner
Composes server level middleware
Runner
Composes global and named middleware together. Pass empty array when no named middleware are supposed to be executed.
Kind: global function
Param | Type |
---|---|
namedReference | Array |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
Found 1/7 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
36 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More