Registry / web-framework / adonis-middleware

adonis-middleware

JSON →
library1.0.14jsnpmunverified

Official collection of middleware for AdonisJS (Adonis Framework), including BodyParser, CORS, Flash, and Shield. Current version 1.0.14, last updated in 2016. This package is part of the legacy AdonisJS 4.x ecosystem and provides HTTP middleware providers for common web security and request parsing tasks. Unlike third-party middleware packages, these are the officially maintained set, tightly integrated with the framework's provider system. Release cadence is low; package is in maintenance mode as AdonisJS moved to a new architecture in v5. Key differentiator: official, framework-specific middleware providers that register automatically via AdonisJS IoC container.

npm install adonis-middleware
INSTALL
IMPORT
SIG · ADONIS-MIDDLEWARE
A
adonis-middleware
web-frameworkjavascriptv1.0.14
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AppMiddlewareProvider
✓ import AppMiddlewareProvider from 'adonis-middleware/providers/AppMiddlewareProvider'
✗ const AppMiddlewareProvider = require('adonis-middleware')
ESM-style import from specific path; CommonJS users should use require('adonis-middleware/providers/AppMiddlewareProvider')
BodyParser
✓ import { BodyParser } from 'adonis-middleware'
✗ import BodyParser from 'adonis-middleware'
Named export, not default; use destructuring
Cors
✓ import { Cors } from 'adonis-middleware'
✗ const Cors = require('adonis-middleware').Cors
Works in CJS, but destructuring works too; preferred pattern for clarity

Register AdonisMiddleware providers in the AdonisJS 4.x app bootstrap file.

// bootstrap/app.js const providers = [ 'adonis-middleware/providers/AppMiddlewareProvider' ] // Start the server const { Ioc } = require('adonis-fold') const app = new (require('adonis-framework/src/App'))() app.registerProviders(providers)
Debug
Known issues
deprecatedThis package is for AdonisJS 4.x only and is not compatible with AdonisJS 5+
fix
Use the built-in middleware or AdonisJS v5 official packages
affects: >=5.0
breakingProvider registration path changed in v1.0.0: use 'adonis-middleware/providers/AppMiddlewareProvider'
fix
Update provider path in bootstrap/app.js
affects: <1.0
gotchaThe package does not export default; all exports are named
fix
Use destructuring: import { Cors } from 'adonis-middleware'
affects: >=0.0
Errors
Common errors & fixes
Error: Cannot find module 'adonis-middleware'
Package not installed or wrong import path
fix
npm install adonis-middleware --save
TypeError: AppMiddlewareProvider is not a constructor
Incorrect import style (default vs named)
fix
Use import AppMiddlewareProvider from 'adonis-middleware/providers/AppMiddlewareProvider'
Error: ENOENT: no such file or directory, open '.../node_modules/adonis-middleware/providers/AppMiddlewareProvider.js'
Provider path missing due to version mismatch
fix
Reinstall package: npm install adonis-middleware@1.0.14
Upgrade
Version history
1.0.14latest on npm
Audit
Dependencies
adonis-frameworkrequiredCore framework dependency for middleware base classes
Agent activity
58 hits · last 30 days
node
51
OpenAI (training)
2
Resources
adonis-middleware — npm install adonis-middleware · libregistry